Hi again,

I惴 trying to understand how to make 3 dependent ComboBoxes...

I悲 have coded the following example:

3Combos.png

3Combosb.png

Formula: copy to clipboard
Private Sub UserForm_Initialize()

With ComboBox1
.AddItem "A"
.AddItem "B"

End With

End Sub


Private Sub ComboBox1_Change()

Dim index As Integer
index = ComboBox1.ListIndex

ComboBox2.Clear

Select Case index
Case Is = 0
With ComboBox2
.AddItem "A.1"
.AddItem "A.2"

End With
Case Is = 1
With ComboBox2
.AddItem "B.1"
.AddItem "B.2"
.AddItem "B.3"

End With
End Select

End Sub

Private Sub ComboBox2_Change()

Dim index As Integer
index = ComboBox2.ListIndex

ComboBox3.Clear

Select Case index
Case Is = 0
With ComboBox2
.AddItem "A.1.1"
.AddItem "A.1.2"
.AddItem "A.1.3"
.AddItem "A.1.4"
.AddItem "A.1.5"
.AddItem "A.1.6"
.AddItem "A.1.7"


End With
Case Is = 1
With ComboBox2
.AddItem "A.2.1"
.AddItem "A.2.2"
.AddItem "A.2.3"
.AddItem "A.2.4"


End With


Case Is = 2
With ComboBox2
.AddItem "B.1.1"
.AddItem "B.1.2"
.AddItem "B.1.3"
.AddItem "B.1.4"
.AddItem "B.1.5"
.AddItem "B.1.6"
.AddItem "B.1.7"


End With

Case Is = 3
With ComboBox2
.AddItem "B.2.1"
.AddItem "B.2.2"
.AddItem "B.2.3"
.AddItem "B.2.4"


End With

Case Is = 4
With ComboBox2
.AddItem "C.3.1"
.AddItem "C.3.3"
.AddItem "C.3.3"
.AddItem "C.3.4"


End With


End Select

End Sub



...When I test the code, ComboBox1 and ComboBox2 work fine but ComboBox3 never display the entries...Why?


Thanks in advance,
Ruben