VBA listbox search

chunu

Board Regular
Joined
Jul 5, 2012
Messages
109
Office Version
  1. 2013
Platform
  1. Windows
  2. Mobile
Hi,
can some one help me to add search option in user form(search as you type)
here is the code
Code:
Private Sub cmdadd_Click()
Dim addme As Range
    Dim x As Integer
    Set addme = Sheet1.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
    For x = 0 To Me.lstSelector.ListCount - 1
        If Me.lstSelector.Selected(x) Then
            addme = Me.lstSelector.List(x)
            addme.Offset(0, 1) = Me.lstSelector.List(x, 1)
            addme.Offset(0, 2) = Me.lstSelector.List(x, 2)
            addme.Offset(0, 3) = Me.lstSelector.List(x, 3)
            addme.Offset(0, 4) = Me.lstSelector.List(x, 4)
            addme.Offset(0, 5) = Me.lstSelector.List(x, 5)
            Set addme = addme.Offset(1, 0)
        End If
    Next x
    For x = 0 To Me.lstSelector.ListCount - 1
        If Me.lstSelector.Selected(x) Then Me.lstSelector.Selected(x) = False
    Next x
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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