Good Morning Fellows,
I hope to find the needed assistance here.
My project has 3 different Combo Boxes
The 1st One is linked in Cell C1
The 1st One is linked in Cell D1
The 1st One is linked in Cell E1
I need to link them to be dependents ones
I wrote VBA Code as below
But it seems that it doesn’t work with the 3rd Combo Box for some reason
Could you advise what is wrong with the code?
P.S. I know Dependent Data Validation Lists is an option but this sheet is sample prototype of another original sheet and it needs combo boxes, not data validation list option
Thank you
I hope to find the needed assistance here.
My project has 3 different Combo Boxes
The 1st One is linked in Cell C1
The 1st One is linked in Cell D1
The 1st One is linked in Cell E1
I need to link them to be dependents ones
I wrote VBA Code as below
Code:
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "X"
.AddItem "Y"
.AddItem "Z"
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"
.AddItem "B"
.AddItem "C"
End With
Case Is = 1
With ComboBox2
.AddItem "D"
.AddItem "E"
.AddItem "F"
End With
Case Is = 2
With ComboBox2
.AddItem "G"
.AddItem "H"
.AddItem "I"
End With
End Select
End Sub
Private Sub ComboBox2_Change()
Dim Index As Integer
Index = ComboBox2.ListIndex
ComboBox3.Clear
Select Case Index
Case "D1" = "A"
With ComboBox3
.AddItem "1"
.AddItem "2"
.AddItem "3"
End With
Case "D1" = "B"
With ComboBox3
.AddItem "4"
.AddItem "5"
.AddItem "6"
End With
Case "D1" = "C"
With ComboBox3
.AddItem "7"
.AddItem "8"
.AddItem "9"
End With
Case "D1" = "D"
With ComboBox3
.AddItem "10"
.AddItem "11"
.AddItem "12"
End With
Case "D1" = "E"
With ComboBox3
.AddItem "13"
.AddItem "14"
.AddItem "15"
End With
Case "D1" = "F"
With ComboBox3
.AddItem "16"
.AddItem "17"
.AddItem "18"
End With
Case "D1" = "G"
With ComboBox3
.AddItem "19"
.AddItem "20"
.AddItem "21"
End With
Case "D1" = "H"
With ComboBox3
.AddItem "22"
.AddItem "23"
.AddItem "24"
End With
Case "D1" = "I"
With ComboBox3
.AddItem "25"
.AddItem "26"
.AddItem "27"
End With
End Select
End Sub
But it seems that it doesn’t work with the 3rd Combo Box for some reason
Could you advise what is wrong with the code?
P.S. I know Dependent Data Validation Lists is an option but this sheet is sample prototype of another original sheet and it needs combo boxes, not data validation list option
Thank you