Search as you type dropdown box in userform combobox - Excel

RJ1969

Board Regular
Joined
Sep 13, 2014
Messages
76
Hello,
I have created a userform with a combobox with a dropdown list.

I am currently having trouble creating a combobox which performs searches as I type into it.
For example if I type John then it will automatically searches anything that has John Mendoza, Jonh Luis Martinez and Michael John Lewis.

Can someone to please modify the code below for me to able to search as I type in the combobox?
So far, My code in userform1 (frmInputs) is this:

Const header = "C5,a"
Const mySheet = "Sheet1"

Private Sub CommandButton1_Click()
If UBound(headerArr) Mod 2 <> 1 Then MsgBox "Error in Cell Address & Header pair"
For a = 0 To (UBound(headerArr) - 1) / 2
Range(headerArr(a * 2)).Offset(0, 1) = InputBox(headerArr(a * 2 + 1), "Field Entry")
Next
End Sub
Private Sub cmdOK_Click()
headerArr = Split(header, ",")
Set sht = Worksheets(mySheet)
For a = 0 To (UBound(headerArr) - 1) / 2
sht.Range(headerArr(a * 2)) = Controls("TextBox" & (a + 1))
Next



Thank you in advance!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I have a UserForm that does what you are asking for, but it does it for worksheet names. If you modify the code to iterate your array or range of values in place of where I iterate the sheet names, I think you should be able to end up with what you want. Note that I uses a TextBox and a Listbox and provide the user the ability to type the name up to whatever point they want and to mix that with arrow key presses to make the final selection plus it allows for natural text editing as well. Here is link to the mini-blog article for this UserForm...

<!-- title / author block -->A Neat "Go To Sheet" Selector
 
Upvote 0
Hi Ford,
I am so sorry about x-posting. I won't happen again. Like I said I am kinda new with this site. I dont really know what I was doing.
I did not receive any response for my posting on this site for a few days and so I thought there was some kind of problem. Then I just received some post answer just right now from you and from Rick. Thank you :eek:)
So far, the issue has not been solve yet. I don't know what I really need to do.
I need to actually someone to modify the code.
Thank you.
 
Upvote 0
Hi again,
Actually I don't need the code to be modified. I just need actually a code to add so that the combobox with a dropdown box that I have in the userform be able to search as I type e.g. john then john martinez, john rodriguez or john lewis will search.

Thank you.
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,348
Members
449,443
Latest member
Chrissy_M

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