Form combo box question

  • Thread starter Thread starter TyeJae
  • Start date Start date
T

TyeJae

I want to use a form because I like it alot better than just throwin
combo box's in excel cells, but I have run into a problem. I want t
have a combo box read off from another combo box and I cannot figure i
out. Example.

Combo Box 1:
Assembly
FIP
Slush

Combo Box 2:
IF Assembly: Rob, John, Natalie, Jen
IF FIP: Suwan, Kham, Sam
IF Slush: Eric, Chhoung, Marc, Tom

I will get way more in depth than this with that actual combo boxes.
Combo Box 1 will have 14 dropdowns, and Combo Box 2 will have 1
options per item in Combo Box 1.

Thanks for your help,
TyeJa
 
use the primary combo_change event to change row source of
the secondary combo box

Private Sub ComboBox1_Change()

select case ComboBox1.Text

case "Assembly"
ComboBox2.RowSource = "AssemblyDetails"
case "FIP"
ComboBox2.RowSource = "FIPDetails"
' .....
end select

' note that assemblyDetails is a range that contains the
other values.

End Sub
 
I am fairly new to this so I apologize for not understanding. I hav
been working on this for a while now with no luck. So I must ask fo
your help again if you dont mind. Here is where I am at, I got th
first combo box named cboName to work, but I cannot get my second comb
box to work named cboResult. Here is the code I used.

Private Sub UserForm_Initialize()
With cboName
.AddItem "Assembly"
.AddItem "FIP"
.AddItem "Slush"
End With
cboName.Value = ""
Select Case cboName.Text
Case "Assembly"
cboSelect.RowSource = "AssemblyData"
Case "FIP"
cboSelect.RowSource = "FIPData"
Case "Slush"
cboSelect.RowSource = "SlushData"
End Select
End Sub

Thanks a ton
 
Ok I just tried an IF, Then statement and that wouldn't work for me
either. Anybody got any suggestions?
 
you need to split that macro into two parts.

one to initialize box 1

two to populate box 2 when you click or change something on box 1.

(sorry, i can't test this for you, but hopefully it gets you on th
right track...)

Private Sub UserForm_Initialize()
With cboName
.AddItem "Assembly"
.AddItem "FIP"
.AddItem "Slush"
End With
cboName.Value = ""
End Sub

Private Sub cboName_Change
Select Case cboName.Text
Case "Assembly"
cboSelect.RowSource = "AssemblyData"
Case "FIP"
cboSelect.RowSource = "FIPData"
Case "Slush"
cboSelect.RowSource = "SlushData"
End Select
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top