PDA

View Full Version : List Box



seval
01-28-2008, 07:47 AM
Hi All,

I'm new to VBA and hope someone can help me out here.

I would like to have 2 list box, List box A and List box B. So, when I select an option in list box A, list box B will automatically show the values of the option I chose (in this case, there are different set of values for different options) and I can choose from list box B the value I want. Anyone has a code for that? I have been looking for a tutorial but has not been able to find one that shows what I want to do. Thanks to anyone who can help.

mikerickson
01-28-2008, 08:07 AM
If the entries for your first list is in A1:A10, (Lets say "one","two","three",..)

And the entries for List2 are in B1:K15,
B1:B15 for "one"
C1:C15 for "two"
etc.

Get a list box from the Forms menu, assign its controls to input Range A1:A10 and linked Cell to A11.

Define a named Range
name: secondList
RefersTo: =OFFSET(Sheet1!$A$1,0,Sheet1!$A$11,15,1)

Then you second listbox should have its input range set to secondList