Combo Box Help

  • Thread starter Thread starter towl
  • Start date Start date
T

towl

Hi all, hopefully someone can help me out.

I have created a combo box (from the control toolbox), and have
assigned a linked cell and a list fill range.

I now want to create a 2nd combo box, that will bring back a second set
of results based on the outcome of the first combo box.

I know this can be done using data validation, however I am trying to
get it done through VBA, so I can design a form for my colleagues to
use.

If the above was unclear, think Car manufacturers and models, depending
on what car manufactuer is selected (viabox 1), I want only certain
models to be shown in box2.

Any help would be appreciated.
 
In the click even of the first combobox, populate the second using add item


Private Sub Combobox1_Click()
Dim rng as Range
set rng = Range(combobox1.ListFillRange)
' combobox2 should not have a listfillrange assignment
Combobox2.Clear
for each cell in rng
if cell.Value = Combobox1.Value then
Combobox2.AddItem cell.offset(0,1).Value
end if
Next
End Sub
 
Thanks for the help Tom, but still doesn't seem to be working,


I have assigned a list name in Excel, that corresponds to the names i
the combobox1 list, and it is this that I am wanting to pick up, gues
I am trying to run before I can walk, as only started using Vba las
week.

Does anyone else have any ideas
 
Private Sub Combobox1_Click()
If Combobox1.ListIndex <> -1 then
Combobox2.List = Range(Combobox1.Value).Value
End if
End Sub

If you tell the whole story in the beginning, you increase your chances of
getting a usable answer. Otherwise we have to guess to fill in the blanks.
 

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

Similar Threads

combo box 2
combo box 1
Combo box in user form 5
synchronize combo boxes 7
Combo Box Question 22
How to populate Combo Box ?? 3
Having trouble with combo boxes. 11
synchronize combo boxes 1

Back
Top