ComboBox AutoWordSelect issue?

underpressure

Board Regular
Joined
Nov 24, 2012
Messages
141
When debugging, UserForm ComboBox1 and 2 will “auto select” the names in the ranges.
I can enter the first letter in the ComboBox and the item is displayed, in this case, Range R is a list of cities, Range S is a list of States.

When the UserForm is run LIVE, I must enter the entire city or state name even though the ComboBoxes display the lists.

What can I do to resolve this issue?

Code:
Private Sub UserForm_Initialize()
Dim x
Dim y
With Sheets("Settings")
    For x = 1 To .Cells(Rows.Count, "R").End(xlUp).Row
        ComboBox1.AddItem (.Range("R" & x).Value)
    Next x
    For y = 1 To .Cells(Rows.Count, "S").End(xlUp).Row
        ComboBox2.AddItem (.Range("S" & y).Value)
    Next y
End With
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Not sure what your problem is, but you can populate the combos like
Code:
Private Sub UserForm_Initialize()
   With Sheets("settings")
      Me.ComboBox1.List = .Range("R2", .Range("R" & Rows.Count).End(xlUp)).Value
      Me.ComboBox2.List = .Range("S2", .Range("S" & Rows.Count).End(xlUp)).Value
   End With
End Sub
rather than looping through the ranges.
 
Upvote 0
Thanks for the tip Fluff.

The combos populate properly.
But, items must be selected from the lists.
I'd like to type the first few letters of the city name and have it automatically select the city...so I don't have to select or type the entire name into the combo.
If "c" is entered into combobox1, Chicago is displayed
if "d" is entered, Detroit is displayed
if "r" is entered, and no city in the list starts with R, then I must enter the entire city name into the combobox.

It works when run from debugging but not when the project is live.
 
Upvote 0
What do you have set for "MatchEntry" in the properties window?
 
Upvote 0
I cannot replicate your problem, so not sure what is happening.
If I type in an initial letter the combo autofills with the first value in the list that starts with that letter.
 
Upvote 0
You don't by any chance have spaces before some of the words do you?
Also it may be worth deleting that combobox & then adding a new one, to see if that fixesit.
 
Upvote 0

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

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