Create Cascading ComboBoxes in a UserForm

The following code creates cascading comboboxes, where ComboBox2 is dependent on the value selected from ComboBox1. It is assumed that you've already created a UserForm that contains two ComboBoxes.

Private Sub ComboBox1_Change()


    Select Case Me.ComboBox1.Value
        Case "A"
            With Me.ComboBox2
                .AddItem "Adam"
                .AddItem "Allen"
                .AddItem "Andy"
            End With
        Case "B"
            With Me.ComboBox2
                .AddItem "Barb"
                .AddItem "Bill"
                .AddItem "Bob"
            End With
        Case "C"
            With Me.ComboBox2
                .AddItem "Carl"
                .AddItem "Charles"
                .AddItem "Chris"
                .AddItem "Cindy"
            End With
    End Select
End Sub

Private Sub UserForm_Initialize()

    With Me.ComboBox1
        .AddItem "A"
        .AddItem "B"
        .AddItem "C"
    End With
End Sub

Where to Put the Code

  1. Open the workbook in which to store the code.
  2. Open the Visual Basic Editor (Alt+F11).
  3. In the Project Explorer window (Ctrl+R), right-click the UserForm, and select View Code.
  4. Copy and paste the above code into the code module for the UserForm.
  5. Return to Microsoft Excel (Alt+Q).
  6. Save the workbook.

Sample Workbook: Download