Liebe Community,
ich stehe vor einem Problem, und zwar bin ich nicht gut in der VBA Programmierun. Ich habe ein Programm zur Abfrage von Checkboxen verbunden in eine Excel Tabelle.
Dies Funktioniert soweit auch sehr gut. Jedoch möchte ich vor der Abfrage noch definieren das wenn Optionbutton1 aktiv ist nur Daten welche den Begriff Modul (hinterlegt in Spalte AB) ausgegeben werden und wenn Optionbutton 2 aktiv ist nur Daten mit dem Begriff Maschine ausgegeben werden.
Ich weiß nicht wie ich dies machen soll.
Ich hoffe das ihr mir helfen könnt!
Anbei der Code den ich bisher habe:
Private Sub CommandButton1_Click()
Dim Stoff(1 To 35) As Boolean
Dim Text As String
If UserForm2.CheckBox1.Value = True Then Stoff(1) = "true" Else Stoff(1) = "false"
If UserForm2.CheckBox2.Value = True Then Stoff(2) = "true" Else Stoff(2) = "false"
If UserForm2.CheckBox3.Value = True Then Stoff(3) = "true" Else Stoff(3) = "false"
If UserForm2.CheckBox4.Value = True Then Stoff(4) = "true" Else Stoff(4) = "false"
If UserForm2.CheckBox5.Value = True Then Stoff(5) = "true" Else Stoff(5) = "false"
If UserForm2.CheckBox6.Value = True Then Stoff(6) = "true" Else Stoff(6) = "false"
If UserForm2.CheckBox7.Value = True Then Stoff(7) = "true" Else Stoff(7) = "false"
If UserForm2.CheckBox8.Value = True Then Stoff(8) = "true" Else Stoff(8) = "false"
If UserForm2.CheckBox9.Value = True Then Stoff(9) = "true" Else Stoff(9) = "false"
If UserForm2.CheckBox10.Value = True Then Stoff(10) = "true" Else Stoff(10) = "false"
If UserForm2.CheckBox11.Value = True Then Stoff(11) = "true" Else Stoff(11) = "false"
If UserForm2.CheckBox12.Value = True Then Stoff(12) = "true" Else Stoff(12) = "false"
If UserForm2.CheckBox13.Value = True Then Stoff(13) = "true" Else Stoff(13) = "false"
If UserForm2.CheckBox14.Value = True Then Stoff(14) = "true" Else Stoff(14) = "false"
If UserForm2.CheckBox15.Value = True Then Stoff(15) = "true" Else Stoff(15) = "false"
If UserForm2.CheckBox16.Value = True Then Stoff(16) = "true" Else Stoff(16) = "false"
If UserForm2.CheckBox17.Value = True Then Stoff(17) = "true" Else Stoff(17) = "false"
If UserForm2.CheckBox18.Value = True Then Stoff(18) = "true" Else Stoff(18) = "false"
If UserForm2.CheckBox19.Value = True Then Stoff(19) = "true" Else Stoff(19) = "false"
If UserForm2.CheckBox20.Value = True Then Stoff(20) = "true" Else Stoff(20) = "false"
If UserForm2.CheckBox21.Value = True Then Stoff(21) = "true" Else Stoff(21) = "false"
If UserForm2.CheckBox22.Value = True Then Stoff(22) = "true" Else Stoff(22) = "false"
If UserForm2.CheckBox23.Value = True Then Stoff(23) = "true" Else Stoff(23) = "false"
If UserForm2.CheckBox24.Value = True Then Stoff(24) = "true" Else Stoff(24) = "false"
If UserForm2.CheckBox25.Value = True Then Stoff(25) = "true" Else Stoff(25) = "false"
If UserForm2.CheckBox26.Value = True Then Stoff(26) = "true" Else Stoff(26) = "false"
If UserForm2.CheckBox27.Value = True Then Stoff(27) = "true" Else Stoff(27) = "false"
If UserForm2.CheckBox28.Value = True Then Stoff(28) = "true" Else Stoff(28) = "false"
If UserForm2.CheckBox29.Value = True Then Stoff(29) = "true" Else Stoff(29) = "false"
If UserForm2.CheckBox30.Value = True Then Stoff(30) = "true" Else Stoff(30) = "false"
If UserForm2.CheckBox31.Value = True Then Stoff(31) = "true" Else Stoff(31) = "false"
If UserForm2.CheckBox32.Value = True Then Stoff(32) = "true" Else Stoff(32) = "false"
If UserForm2.CheckBox33.Value = True Then Stoff(33) = "true" Else Stoff(33) = "false"
If UserForm2.CheckBox34.Value = True Then Stoff(34) = "true" Else Stoff(34) = "false"
If UserForm2.CheckBox35.Value = True Then Stoff(35) = "true" Else Stoff(35) = "false"
maxRow = Worksheets("u01_uebersicht").Cells(1048576, 1).End(xlUp).Row
Text = ""
For i = 2 To maxRow + 1
Count = 0
For j = 1 To 35
If Stoff(j) = True And Worksheets("u01_uebersicht").Cells(i, j + 2).Value = False Then
Count = Count + 1
End If
Next j
If Count = 0 Then
Text = Text + Worksheets("u01_uebersicht").Cells(i, 38).Value + Chr(13)
End If
Next i
UserForm2.TextBox1.Text = Text
End Sub
|