List Boxes

G

Guest

Hi All,

How can I make a list box that has a series of values that
are based on the values selected in another list box.

Example

List Box 1
A
B
C

List Box 2: If A is selected from List Box 1, List Box 2
will show
A1
A2
A3

or if B is selected
B1
B2
B3

or if C is selected
C1
C2
C3

this is a very simplistic example.

Thanks in Advance
 
M

mangesh_yadav

for the first listbox enter the following code

Private Sub ListBox1_Click()

If ListBox1 = "a" Then
ListBox2.ListFillRange = "f21:f22"
ElseIf ListBox1 = "b" Then
ListBox2.ListFillRange = "g21:g23"
Else
ListBox2.ListFillRange = "h21:h22"
End If

End Sub


f21:f22 range has a1 and a2
g21:f23 range has b1, b2 and b3
h21:f22 range has c1 and c2


- Manges
 

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