Hello friends,
I have created a userform with different dropdown menus. Everything works fine, but so far my code only displays the lines that contain the exact word that I select in the dropdown menu.
My wish would be that also lines are selected, in which the word from the dropdown menu is plus something else.
As an example:
A table with column A in which in row 1: DE, in row 2: ENG, in row 3: PO and in row 4: DE PO.
In my dropdown list I now have DE, ENG, PO. If I now select DE, only line 1 is displayed and not line 1 and line 4.
How do I get this right?
With Excel formulas this would be "*"&...&"*". Unfortunately, this does not work in VBA.
My code is:
Private Sub Suchen_DblClick(ByVal Cancel As MSForms.ReturnBoolean) 'L?ndersuche
Dim S$, Rc As Range, Rb As Range, N&
S = Dropdownland: If S = "" Then Exit Sub
Set Rc = ActiveSheet.UsedRange.Rows
Application.ScreenUpdating = False
Rc.EntireRow.Hidden = False
For Each Rc In Range("G62:G" & Rc(Rc.Count).Row)
If StrComp(Rc.Columns(), S, 1) Then
If Rc.Font.Bold Then Set Rb = Rc
Rc.EntireRow.Hidden = True
ElseIf Not Rb Is Nothing Then
Rb.EntireRow.Hidden = False
Set Rb = Nothing
End If
Next
Application.ScreenUpdating = True
Set Rb = Nothing
Suchfeld = ""
Unload Me
End Sub
I would be insanely happy about an answer!
PS: can someone possibly tell me why the userform does not close on empty input? For that I have extra If S="" Then Exit Sub
Bookmarks