I'm creating a dependent drop down box using ComboBoxs. I have a total of 3 boxes dependent upon the previous. I've written the below so far but it's not working. When I select the item in the 2 drop down it doesn't appear in the drop down. Or (If i take out the .clear from below) the list expands to include all the items previously selected. AND I still cannot get the last box to work.
I've been working on this stupid thing for a couple days now and my brain is about to explode lol
PS as you can tell when I get to the last button I didn't actually put the options I'm just trying to at least get it to work.
I've been working on this stupid thing for a couple days now and my brain is about to explode lol
PS as you can tell when I get to the last button I didn't actually put the options I'm just trying to at least get it to work.
Code:
Private Sub ComboBox3_Change()
With ComboBox3
.AddItem "Division A: Agriculture, Forestry, And Fishing"
.AddItem "Division B: Mining"
.AddItem "Division C: Construction"
End With
End Sub
Private Sub ComboBox4_Change()
Dim index As Integer
index = ComboBox3.ListIndex
ComboBox4.clear
Select Case index
Case Is = 0
With ComboBox4
.Clear
.AddItem "Major Group 01: Agricultural Production Crops"
.AddItem "Major Group 02: Agriculture production livestock and animal specialties"
.AddItem "Major Group 07: Agricultural Services"
.AddItem "Major Group 08: Forestry"
.AddItem "Major Group 09: Fishing, hunting, and trapping"
End With
Case Is = 1
With ComboBox4
.Clear
.AddItem "Major Group 10: Metal Mining"
.AddItem "Major Group 12: Coal Mining"
.AddItem "Major Group 13: Oil And Gas Extraction"
.AddItem "Major Group 14: Mining And Quarrying Of Nonmetallic Minerals, Except Fuels"
End With
Case Is = 2
With ComboBox4
.Clear
.AddItem "Major Group 15: Building Construction General Contractors And Operative Builders"
.AddItem "Major Group 16: Heavy Construction Other Than Building Construction Contractors"
.AddItem "Major Group 17: Construction Special Trade Contractors"
End With
End Select
End Sub
Private Sub ComboBox5_Change()
Dim index As Integer
index = ComboBox4.ListIndex
ComboBox5.Clear
Select Case index
Case Is = 0
With ComboBox5
.AddItem "last1"
End With
Case Is = 1
With ComboBox5
.AddItem "test2"
End With
Case Is = 2
With ComboBox5
.AddItem "boom3"
End With
End Select
End Sub
Last edited by a moderator: