Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cascade populate combo boxes in Excel 1

Status
Not open for further replies.

Georgews

Instructor
Apr 8, 2001
22
NZ
I have searched the faq's and forums an connot find what I need so far. Please point me to an approriate one if you know of it.

In Excel, I have a worksheet with four columns of data. The first column shows data for the first combo box and I have populated this by simply pointing the row source to this data.

I have set up named ranges for the cols of data corresponding to the value selected in the first box.

What I want is for a second combo box to display one of the columns depending on which value is selected in the first one.

I have been trying to pass the value from the first box to a variable and then use this variable as the row source (named range) for the second box.

Can this be done? Any help greatly apreciated. Cheers
 
Hi Georgews,

What you want is perfectly possible. Something like this (rather poor example) in the first combo's Change event should work:

Code:
[blue]Private Sub ComboBox1_Change()
    If Me.ComboBox1 = "[i]FirstValue[/i]" Then Me.ComboBox2.RowSource = "[i]FirstRangeName[/i]"
    If Me.ComboBox1 = "[i]SecondValue[/i]" Then Me.ComboBox2.RowSource = "[i]SecondRangeName[/i]"
    [green]' etc.[/green]
End Sub[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks Tony, Looks like what I was trying to do -I'll give it try. Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top