Filtering a multi column listbox with case insensitivity

greengbo

New Member
Joined
Jul 14, 2015
Messages
13
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:

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!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top