Option
Explicit
Private
Sub
CommandButton1_Click()
Dim
Stoff(1
To
35)
As
Boolean
Dim
blnFetch
As
Boolean
Dim
maxRow
As
Long
Dim
Text
As
String
Dim
i
As
Long
Dim
j
As
Long
For
i = LBound(Stoff)
To
UBound(Stoff)
Stoff(i) = UserForm2.Controls(
"CheckBox"
& i).Value
Next
With
Worksheets(
"u01_uebersicht"
)
maxRow = .Cells(.Rows.Count,
"A"
).
End
(xlUp).Row
For
i = 2
To
maxRow + 1
blnFetch =
False
For
j = 1
To
35
If
Stoff(j)
And
Not
CBool
(.Cells(i, j + 2).Value)
Then
blnFetch =
True
Exit
For
End
If
Next
If
UserForm2.OptionButton1.Value
Then
blnFetch = blnFetch
And
InStr(1, .Cells(i,
"AB"
).Text,
"Modul"
, vbTextCompare)
ElseIf
UserForm2.OptionButton2.Value
Then
blnFetch = blnFetch
And
InStr(1, .Cells(i,
"AB"
).Text,
"Maschine"
, vbTextCompare)
Else
Exit
Sub
End
If
If
blnFetch
Then
Text = Text & .Cells(i,
"AL"
).Text & vbKeyReturn
End
If
Next
End
With
UserForm2.TextBox1.Text = Text
End
Sub