I have a VBA userform which has two comboboxes and a list box.
What I'm aiming for is that the user can 'shortcut' to the items required in the list box based on the selections made in the combos.
I'm talking about a hierachical geography here, so my first combobox lets me select from a list of 7 items, and based on this the second combo box populates with a list of anything between 1 and 10 items.
That bit works so far (bless the search option in this forum!)
I'm guessing I need to have some kind of loopy thing going through some arrays to set specific items in the list box to "TRUE".
(I want always to display the complete list in the listbox, which I hope makes it easier.)
So, I have the following lookup range in another (hidden) sheet of the same workbook.
[tt]
Reg1 Reg2 Area
LO LO1 A1
LO LO1 A2
LO LO2 A3
etc[/tt]
and the code for my comboboxes:
Its that loopy array bit that is confusing me. If anyone can point me towards some help with that I can possibly work out how to make those items as True innit.
Ta chaps.
Fee
"The cure for anything is salt water – sweat, tears, or the sea." Isak Dinesen
What I'm aiming for is that the user can 'shortcut' to the items required in the list box based on the selections made in the combos.
I'm talking about a hierachical geography here, so my first combobox lets me select from a list of 7 items, and based on this the second combo box populates with a list of anything between 1 and 10 items.
That bit works so far (bless the search option in this forum!)
I'm guessing I need to have some kind of loopy thing going through some arrays to set specific items in the list box to "TRUE".
(I want always to display the complete list in the listbox, which I hope makes it easier.)
So, I have the following lookup range in another (hidden) sheet of the same workbook.
[tt]
Reg1 Reg2 Area
LO LO1 A1
LO LO1 A2
LO LO2 A3
etc[/tt]
and the code for my comboboxes:
Code:
Private Sub RegCombo1_Change()
Dim RadCount As Integer
'Populate the RAD combo box based on the selection from the 'REG' combo box (first two letters)
Select Case RegCombo1.Value
Case Is = "LO": RadCombo1.RowSource = "Validation!B3:B8" '6 items
Case Is = "ME": RadCombo1.RowSource = "Validation!B9:B18" '10 items
Case Is = "NI": RadCombo1.RowSource = "Validation!B19:B19" '1 item
Case Is = "NR": RadCombo1.RowSource = "Validation!B20:B29" '10 items
Case Is = "SC": RadCombo1.RowSource = "Validation!B30:B31" '2 items
Case Is = "SO": RadCombo1.RowSource = "Validation!B32:B38" '7 items
Case Is = "WA": RadCombo1.RowSource = "Validation!B39:B40" '2 items (Wales!)
End Select
'then build some loopy arrays to make appropriate PCO's as TRUE based on selections above
End Sub
Ta chaps.
Fee
"The cure for anything is salt water – sweat, tears, or the sea." Isak Dinesen