Thread: Combo Box Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Combo Box Help

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

--
Regards,
Tom Ogilvy

"towl" wrote in message
...

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.


--
towl
------------------------------------------------------------------------
towl's Profile:

http://www.excelforum.com/member.php...o&userid=26340
View this thread: http://www.excelforum.com/showthread...hreadid=477582