Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lourdes Edwards   on Nov 28 In MS Office Category.

  
Question Answered By: Adelaide Fischer   on Nov 28

Your terminology is a bit confusing.
"Cascading" would imply that you want a separate form to
be displayed.
But your description seems to be as if you have two comboboxes on the
same form...

Are you using a ComboBox in a Form?
or are you referring to a drop-down list  on a spreadsheet?
Where is your source data for the combo-box?

As an example, I set up a sheet with the cells starting at A1 with:

Red Orange Yellow Green Blue Indigo Violet
Red-Red Orange-Red Yellow-Red Green-Red Blue-Red
Indigo-Red Violet-Red
Red-Orange Orange-Orange Yellow-Orange Green-Orange Blue-
Orange Indigo-Orange Violet-Orange
Red-Yellow Orange-Yellow Yellow-Yellow Green-Yellow Blue-
Yellow Indigo-Yellow Violet-Yellow
Red-Green Orange-Green Yellow-Green Green-Green Blue-
Green Indigo-Green Violet-Green
Red-Blue Orange-Blue Yellow-Blue Green-Blue Blue-
Blue Indigo-Blue Violet-Blue
Red-Indigo Orange-Indigo Yellow-Indigo Green-Indigo Blue-
Indigo Indigo-Indigo Violet-Indigo
Red-Violet Orange-Violet Yellow-Violet Green-Violet Blue-
Violet Indigo-Violet Violet-Violet

(sorry about the word-wrap)

thank I created a form with (2) comboboxes and a cancel/OK button.

The actions I used were:


Private Sub UserForm_Initialize()
For col = 1 To 7
ColorSel.ComboBox1.AddItem (Cells(1, col))
Next col
End Sub
Private Sub ComboBox1_Change()
For col = 1 To 7
If (ColorSel.ComboBox1.Value = Cells(1, col)) Then
Exit For
Next col
ColorSel.ComboBox2.Clear
For rnum = 2 To 8
ColorSel.ComboBox2.AddItem (Cells(rnum, col))
Next rnum
End Sub

Private Sub Btn_Cancel_Click()
Unload ColorSel
End Sub

Private Sub Btn_OK_Click()
MsgBox "Selected:" & Chr(13) & ColorSel.ComboBox2.Value
End Sub

this loads the first combobox with the headings.
the change event then searches for a matching header and
loads combobox2 with the values in that column.

look like what you're after?

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Cascading combo boxes Or get search suggestion and latest updates.


Tagged: