EighterFromDecatur
New Member
- Joined
- Aug 27, 2011
- Messages
- 2
VBA newbie here, using Excel 2010. I have a named range containing employees, which I'm populating in a drop-down list on a user form. Occasionally I need to enter a non-employee's name, so I'm trying to use a combo box. In the user form, I expect to be able to type multiple characters until Excel finds an unambiguous match. It's matching on one character but not multiple characters -- even when there's truly a match. Sample data in the combo box is:
Simpson, Ann
Smith, Andrew
Snyder, Marge
Stewart, Bob
If I type "S", it will match the first entry and jump to "Simpson, Ann", but if I type a second character that should match ("Sm," "Sn" or "St"), it quits matching. Here's the code that initializes the combo box, which seems to work fine:
Private Sub UserForm_Initialize()
Dim rng As Range
Dim empl As Variant
Set empl = Worksheets("Sheet1").Range("Employees")
For Each empl In rng
ComboBox1.AddItem empl.Value
Next empl
End Sub
Here are the what I believe are the relevant properties on the ComboBox1 control.
ListStyle = 0 - fmListStylePlain
MatchEntry = 1 - fmMatchEntryComplete
MatchRequired = False
Style = 0 - fmStyleDropDownCombo
Any ideas?
Simpson, Ann
Smith, Andrew
Snyder, Marge
Stewart, Bob
If I type "S", it will match the first entry and jump to "Simpson, Ann", but if I type a second character that should match ("Sm," "Sn" or "St"), it quits matching. Here's the code that initializes the combo box, which seems to work fine:
Private Sub UserForm_Initialize()
Dim rng As Range
Dim empl As Variant
Set empl = Worksheets("Sheet1").Range("Employees")
For Each empl In rng
ComboBox1.AddItem empl.Value
Next empl
End Sub
Here are the what I believe are the relevant properties on the ComboBox1 control.
ListStyle = 0 - fmListStylePlain
MatchEntry = 1 - fmMatchEntryComplete
MatchRequired = False
Style = 0 - fmStyleDropDownCombo
Any ideas?
Last edited: