Okay, friends, this macro works, but can you help me and tell me where to put the asterisk (*) to be able to search any word, not just the first word.
Now do the following:
Ivan Petrovski Kadvistinski
If I write Ivan - I found the name, but if you write Petrovski - not him alone.
After a night of surfing the web mention of this (*) to search for any word.
Thank you in advance, and you may think of another solution.
Private Sub TextBox1_Change()Dim i As Long
Dim sFind As String
sFind = Me.TextBox1.Text
If Len(sFind) = 0 Then
Me.ListBox1.ListIndex = -1
Me.ListBox1.TopIndex = 0
Else
For i = 0 To Me.ListBox1.ListCount - 1
If UCase(Left(Me.ListBox1.List(i), Len(sFind))) = UCase(sFind) Then
Me.ListBox1.TopIndex = i
Me.ListBox1.ListIndex = i
Exit For
End If
Next i
End If
End Sub