PDA

View Full Version : Solved: Combobox - Linked List



phendrena
11-13-2008, 08:55 AM
Hi there,

I have a series of named ranges setup on a worksheet "Lookups".
I have two comboboxes on my userform.

If the user chooses an option in box 1 then box 2 should be populated based on what is chosen by the user in box 1.

Can you provide me assistance on how to do this please?

Thanks,

Bob Phillips
11-13-2008, 10:29 AM
Private Sub ComboBox1_Change()
With ComboBox2
.List = Application.Transpose(Worksheets("Lookups").Range(ComboBox1.Value))
.ListIndex = -1
End With
End Sub

MaximS
11-13-2008, 10:33 AM
sample workbook will help us to help you :)

phendrena
11-14-2008, 05:52 AM
Private Sub ComboBox1_Change()
With ComboBox2
.List = Application.Transpose(Worksheets("Lookups").Range(ComboBox1.Value))
.ListIndex = -1
End With
End Sub


That works very nicely, thank you.
One other question, when working in a standard worksheet and you create linked lists that have more than one word you use the SUBSTITUTE function to remove the extra spaces. How can i do this in the code above?


sample workbook will help us to help you :)

I'd normally post a workbook, but in this case it's just a general question and I don't really feel that posting a workbook would be needed.


Thanks,

Bob Phillips
11-14-2008, 07:23 AM
Private Sub ComboBox1_Change()
With ComboBox2
.List = Application.Transpose(Worksheets("Lookups").Range(Replace(ComboBox1.Value, " ", "")))
.ListIndex = -1
End With
End Sub

phendrena
11-14-2008, 08:00 AM
Private Sub ComboBox1_Change()
With ComboBox2
.List = Application.Transpose(Worksheets("Lookups").Range(Replace(ComboBox1.Value, " ", "")))
.ListIndex = -1
End With
End Sub

Excellent Stuff!!!

Thank you so much :beerchug: