UserForm that allows a user to start typing what they need.

USAMax

Well-known Member
Joined
May 31, 2006
Messages
846
Office Version
  1. 365
Platform
  1. Windows
I very much like this link:

Populate userform combobox with unique values from a range

It explains how to get a drop down list of unique values and that is exactly what I need but I have almost 7000 options.

I want the user to be able to start typing the value and have the drop-down populate the first match.

For example, if the user is typing 442810004 and they enter the first five digits and the next value that matches is 442810004 then the user should be able to hit enter to accept this value and go onto the next drop-down.

Code:
Private Sub UserForm_Initialize()

Dim v, e
With Sheets("Segments Lookup").Range("AL2:AL6864")
    v = .Value
End With
With CreateObject("scripting.dictionary")
    .comparemode = 1
    For Each e In v
        If Not .exists(e) Then .Add e, Nothing
    Next
    If .Count Then Me.ComboBox1.List = Application.Transpose(.keys)
End With
End Sub
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thank you igold and sorry for the so response. I have been working with this but I am working within a UserForm and this does not directly apply.

I have two fields that can narrow the options for the other field.
If they enter a value from ComboBox1, with 6864 selections, it should reduce the options in ComboBox2 to maybe 3 or for.
If they enter a value from ComboBox2, with 49841 selections, it should reduce the options in ComboBox1 to less than a hundred.

My issue is the link I provided above works but it does not provide AutoComplete functionality and as it makes the changes in the Initialize phase it does not narrow any of the options.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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