Display specific values in Dropdown2 based on selection in Dropdow

S

sam

Hi All!

Is there a way to display specific values in a "dropdown2" list based on
selecting a value in "Dropdown1" list?

For eg:
Dropdown1 Values: 1,2,3
Dropdown2 Values: 1a,1b,1c,2a,2b,2c,3a,3b,3c

So, If I select "1" in Dropdown1 then I want Dropdown2 to display 1a, 1b, 1c
ONLY
IF I select "2" in Dropdown1 then I want Dropdown2 to display 2a, 2b, 2c ONLY
and so on...

PLEASE HELP!

Thanks in advance
 
S

sam

Hey John, Thanks for you help, But I want this in Excel Userform that is in
VBA, The website you told has worksheet examples.

Thanks for you help though
 
J

john

Sam,
sorry mis-understood that.
See if this approach helps you:

Private Sub UserForm_Initialize()

ComboBox1.List = Array("1", "2", "3")

ComboBox1.ListIndex = 0

End Sub

Private Sub ComboBox1_Change()

With Me.ComboBox2

Select Case Me.ComboBox1.Text

Case "1"

.Clear

.List = Array("1a", "1b", "1c")

.ListIndex = 0

Case "2"

.Clear

.List = Array("2a", "2b", "2c")

.ListIndex = 0

Case "3"

.Clear

.List = Array("3a", "3b", "3c")

.ListIndex = 0

Case Else

' ignore

End Select
End With

End Sub
 

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