userform search

pells

Active Member
Joined
Dec 5, 2008
Messages
361
I have a simple user form that has a ListBox with it's rowsource set to a named range in my workbook.

What I am trying to do is to have a TextBox on my userform that when you enter text into the TextBox, the ListBox shows the results of what is searched.

Is this possible and if so, does anyone know how?

Any help would be much appreciated.

Many thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Place this code to your Search Textbox:

Code:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
ListBox1.Value = TextBox1.Text
End Sub
 
Upvote 0
Place this code to your Search Textbox:

Code:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
ListBox1.Value = TextBox1.Text
End Sub
Many thanks for this.

I have 3 columns in my ListBox which this only works for the 1st column. Can the code be changed to look at all 3 columns?

Also, you have to press Enter to goto the first search record. Is it possible to also change the cose so that the ListBox filters down to what you are entering in the TextBox?

Once again, many thanks for your help, it is much appreciated/
 
Upvote 0
Can anyone help me with this?

Basically, I would like to have a user form which has a search box and a list box. The list box contains a named range in my workbook. When something is typed in the search box, the contents of my list box is filtered to what is being typed in my search box?

Any help to get me started would be much appreciated as I am going round in circles with this :-(
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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