Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Need help in creating dynamic drop down list in userform

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 =)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Need help in creating dynamic drop down list in userform

Hi

one way of doing it would be to use array's this is fine if your
options will not need to change on a regular basis

Private Sub ComboBox2_Change()

Select Case ComboBox2.Value

Case "Wheels"

ComboBox3.List = Array("bus", "car", "bicycle")

Case "No Wheels"

ComboBox3.List = Array("walk", "swim", "run")

End Select

End Sub

hope this helps

S


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Need help in creating dynamic drop down list in userform

Thanks Incidental for providing help, fixed it,
thanks ;

On Sep 25, 5:34 pm, Incidental wrote:
Hi

one way of doing it would be to use array's this is fine if your
options will not need to change on a regular basis

Private Sub ComboBox2_Change()

Select Case ComboBox2.Value

Case "Wheels"

ComboBox3.List = Array("bus", "car", "bicycle")

Case "No Wheels"

ComboBox3.List = Array("walk", "swim", "run")

End Select

End Sub

hope this helps

S



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic drop down list Bala Excel Worksheet Functions 2 October 28th 09 12:00 PM
Dynamic Drop Down List I''m Still Here Excel Discussion (Misc queries) 5 March 22nd 06 08:46 PM
Creating a dynamic list Jarrod A Excel Worksheet Functions 1 November 18th 05 11:29 PM
Creating a dynamic list JarrodA Excel Worksheet Functions 3 October 30th 04 04:01 AM
Creating a dynamic list John N. Excel Programming 1 January 7th 04 09:23 PM


All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"