Thread: combo boxes
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
mwam423 mwam423 is offline
external usenet poster
 
Posts: 103
Default combo boxes

this probably won't work as i've 48 unique companies and counting, and the
product list for many companies will change over time.

"JLGWhiz" wrote:

You could probably do it with two comboboxes. You would need either an If
Then ElseIf Then type algorithm or a Case statement in your first combobox
code so the second combobox would load the right set of product. It would
probably be easier to set up the product lists in four separate ranges than
to use the add item method to load the second combobox. ComboBox1 code would
be something like this:

Sub ComboBox1_Click()
Set ProdRng1 = Range("AA1:AA100")
Set ProdRng2 = Range("BB1:BB100")
If ComboBox1.Value = "Company A" Then
ComboBox2.RowSource = ProdRng1
ElseIf ComboBox1.Value = '"Company B" Then
ComboBix2.RowSource = ProdRng2
'...etc

This is only for illustration purposes, to give you some ideas of approach.


"mwam423" wrote:

greetings! i have two combo boxes in a user form and would like to run a
macro once a choice is made in one of the combo boxes. macro narrows down
the possibilities in subsequent combo box once a selection is first made in
either combo box.

example: combo box 1 is a choice of companies: A, B, C, or D. combo box 2
is list of products sold to that company. would like the list of products
to be able to change depending on which company is selected. additionally,
if a product is chosen from combo box 2, would like combo box 1 to show only
those companies that buy that particular product.

or does it make more sense to have two user forms??