I currently have this code that uses a textbox to search through the populated listbox and removes any entries not matching the value in the textbox. It works great, but if the backspace key is struck it cannot reload the listbox and narrow down the results again.
Private Sub TextBox1_Change()
Dim x, i, ws As Integer
x = Len(TextBox1.Value)
If TextBox1.Value = "" Then
Call update_ListBox1
Exit Sub
End If
For i = ListBox1.ListCount - 1 To 0 Step -1
If UCase(Left(ListBox1.List(i), x)) <> UCase(TextBox1.Value) Then
ListBox1.RemoveItem (i)
End If
Next i
If ListBox1.ListCount > 0 Then
ListBox1.ListIndex = 0
End If
End Sub
Bookmarks