K
kiwis
Hi
I have a userform which allows user to enter data to a worksheet.
The user form have 6 items, 2 of which are dependent on each other.
i have created 6 combobox.
combobox 2 contains drop down list {mode of transport, wheels, no
wheels}
combobox 3 needs to depend on combobox2 selection,
eg combobox2 choose wheels, then combobox3 should show a list
{bus, car, bicycle}
if combobox2 choose no wheels, then combobox3 should show a
list {walk, swim, run}
i'm not sure how to make the combobox3 drop down list to show the
correct list depending on
the selection in combobox2.
partial code
Private Sub UserForm_Initialize()
'drop down list for group <-----combobox 2
For Each cGrp In ws.Range("Grp")
With Me.cboGrp
.AddItem cGrp.Value
.List(.ListCount - 1, 1) = cGrp.Offset(0, 1).Value
End With
Next cGrp
'drop down list depend on what user choose in combobox2 <-----
combobox3
Select Case cbGrp
Case wheels
'drop down list for wheels type
For Each cModel In ws.Range("wheellist")
With Me.cboModel
.AddItem cModel.Value
.List(.ListCount - 1, 1) = cModel.Offset(0,
1).Value
End With
Next cModel
Case nowheels
'drop down list for nowheels
For Each cModel In ws.Range("nowheellist")
With Me.cboModel
.AddItem cModel.Value
.List(.ListCount - 1, 1) = cModel.Offset(0,
1).Value
End With
Next cModel
End Select
The above code does not work, it will always show the wheellist when
either of the choice is selected.
Thank you for helping =)
I have a userform which allows user to enter data to a worksheet.
The user form have 6 items, 2 of which are dependent on each other.
i have created 6 combobox.
combobox 2 contains drop down list {mode of transport, wheels, no
wheels}
combobox 3 needs to depend on combobox2 selection,
eg combobox2 choose wheels, then combobox3 should show a list
{bus, car, bicycle}
if combobox2 choose no wheels, then combobox3 should show a
list {walk, swim, run}
i'm not sure how to make the combobox3 drop down list to show the
correct list depending on
the selection in combobox2.
partial code
Private Sub UserForm_Initialize()
'drop down list for group <-----combobox 2
For Each cGrp In ws.Range("Grp")
With Me.cboGrp
.AddItem cGrp.Value
.List(.ListCount - 1, 1) = cGrp.Offset(0, 1).Value
End With
Next cGrp
'drop down list depend on what user choose in combobox2 <-----
combobox3
Select Case cbGrp
Case wheels
'drop down list for wheels type
For Each cModel In ws.Range("wheellist")
With Me.cboModel
.AddItem cModel.Value
.List(.ListCount - 1, 1) = cModel.Offset(0,
1).Value
End With
Next cModel
Case nowheels
'drop down list for nowheels
For Each cModel In ws.Range("nowheellist")
With Me.cboModel
.AddItem cModel.Value
.List(.ListCount - 1, 1) = cModel.Offset(0,
1).Value
End With
Next cModel
End Select
The above code does not work, it will always show the wheellist when
either of the choice is selected.
Thank you for helping =)