Your question, your audience. Choose who sees your identity—and your question—with question security.
' get rid of unwanted results that do not contain str
Dim ri As Long
With UserForm2.ListBox1
For ri = .ListCount - 1 To 0 Step -1
If .List(ri, 8) <> str Or .List(ri, 9) <> str Then
.RemoveItem ri
End If
Next
End With
' get rid of unwanted results that do not contain str
Dim ri As Long
With UserForm2.ListBox1
For ri = .ListCount - 1 To 0 Step -1
If Not(.List(ri, 8) Like "*" & str & "*") _
Or Not(.List(ri, 9) Like "*" & str & "*") Then
.RemoveItem ri
End If
Next
End With
Regards
If Not(.List(ri, 8) like "*" & str & "*") Or Not(.List(ri, 9) Like "*" & str & "*") Then
If Not(lcase(.List(ri, 8)) like "*" & lcase(str) & "*") Or Not(lcase(.List(ri, 9)) Like "*" & lcase(str) & "*") Then
If InStr(1, .List(ri, 8), str, vbTextCompare) = 0 Then
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.