I am trying to use a listbox with multiple columns to add data to a worksheet. Because this listbox has about 1000 entries, I need a search box filter to help me quickly find the data. I have found some code here that will filter the listbox as long as it is for a singe column and it is case sensitive. Can someone help me make the filter work with multiple columns (it only needs to search the first column, but multiple get added to the worksheet) and allow it to overlook the capitalization?
This is what I have so far:
Thanks in advance for any help!
This is what I have so far:
Code:
Private Sub cmdAdd_Click()
Dim addme As Range
Dim x As Integer
Set addme = Sheet1.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0)
For x = 0 To Me.IngList.ListCount - 1
If Me.IngList.Selected(x) Then
addme = Me.IngList.List(x)
addme.Offset(0, 1) = Me.IngList.List(x, 1)
addme.Offset(0, 2) = Me.IngList.List(x, 2)
addme.Offset(0, 3) = Me.IngList.List(x, 3)
addme.Offset(0, 4) = Me.IngList.List(x, 4)
addme.Offset(0, 5) = Me.IngList.List(x, 5)
addme.Offset(0, 6) = Me.IngList.List(x, 6)
addme.Offset(0, 7) = Me.IngList.List(x, 7)
Set addme = addme.Offset(1, 0)
End If
Next x
For x = 0 To Me.IngList.Selected(x) = False
Next x
End Sub
Private Sub Search_Box_Change()
Dim vList
vList = Application.Transpose(Me.IngList.List)
Me.IngList.List = Filter(vList, Search_Box.Text)
End Sub
Private Sub UserForm_Initialize()
Me.IngList.List = Sheets("Ingredients").Range("B2:I1000").Value
End Sub
Thanks in advance for any help!