Dynamic dropdowns

G

Guest

Hi

-- What I need is in auserform a way of selecting a value from a dropdown
list and depending on the result 1 of 3 different lists of data being loaded
into a second dropdown list box in the same userform. I have seen
http://www.xldynamic.com/source/xld.Dropdowns.html But cannot see how to
incorporate this into a userform presumably via the Row Source property.
Many thanks.
 
G

Guest

I created 4 named ranges "List1" to "List4": "List1" had values 1,2,3.

The following code then set Combobox2 to reference the correct named range.

Hope you can adapt to your needs

Private Sub ComboBox1_Change()
ComboBox2.RowSource = "List" & ComboBox1.Value
End Sub

Private Sub UserForm_Initialize()
ComboBox1.RowSource = "List1"
End Sub

HTH
 
G

Guest

Thanx a million, works a treat.
--
Al


Toppers said:
I created 4 named ranges "List1" to "List4": "List1" had values 1,2,3.

The following code then set Combobox2 to reference the correct named range.

Hope you can adapt to your needs

Private Sub ComboBox1_Change()
ComboBox2.RowSource = "List" & ComboBox1.Value
End Sub

Private Sub UserForm_Initialize()
ComboBox1.RowSource = "List1"
End Sub

HTH
 

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