Dynamic Cascading Lists in Excel
Creating cascading dynamic combo boxes (combo boxes which are linked) in Excel is a very handy tool. It can be done with or without VBA. Combo boxes which are related allow the user to isolate only those values in the second combo box which is related to the selection in the first. The relationship between the combo boxes becomes more complex the more combo boxes being used. In the following example in VBA is used to add relevant items to each of the combo boxes. Each combo box will contain information based on the previous combo box. The following uses VBA to link each of the combo boxes and here is the code which achieves the task. If VBA is not your cup of tea there is an article describing 2 Cascading Lists.
You can see from the above table on the left with the 3 cascading combo boxes on the right. The first combo box contains the unique Regions. The second Combo Box contains the State which relates to the first selection and the city will relate to the state chosen. So in the example above only Sacramento, Los Angeles, San Diego and Fresno are shown in Combo Box 3 when the State of California and Region The West is chosen.
The attached procedure which produces the above result.
If ComboBox1.ListIndex > -1 Then
Private Sub ComboBox2_Change()
Dim i As Integer
Dim ar As Variant
Dim str As String
If n=j + 1 And InStr(str & ",", "," & ar(i, n) & ",")=0 Then
The file outlines the cascading combo boxes method and has the example shown above.