Dynamically updating Combobox

D

Darren Hill

In my form, I have a combobox which includes a list of names harvested
from several worksheets and allows the user to select one.
I'd like for the combobox to operate like this:
* Allows user to pick a name from the list (preferably with match first
letter option)
* Allows user to enter a name, and once done, add that to the combobox
list and sort it.

I find that the combobox_change event keeps firing, so I end up with a
list of partial names.
If I add "Roger" to the list, i'll also end up with "r", "ro", "rog" and
"roge" in the list.

Thanks, Darren.
 
G

Guest

Had the same problem today. Here is the example I used:

Private Sub ComboBox1_Change()
Dim strRange As String
If ComboBox1.ListIndex > -1 Then
strRange = ComboBox1
Label2.Caption = strRange
strRange = Replace(strRange, " ", "_")
With ComboBox2
.RowSource = vbNullString
.RowSource = strRange
.ListIndex = 0
End With
Else
Label2.Caption = "Associated Items"
End If
End Sub

You have to select the first cell in a column and go to Insert>Name>Define
in order to define what the name of your data is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top