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.
Select Case Me.ComboBox1.Value
Private Sub UserForm_Initialize()
Where to Put the Code
- Open the workbook in which to store the code.
- Open the Visual Basic Editor (Alt+F11).
- In the Project Explorer window (Ctrl+R), right-click the UserForm, and select View Code.
- Copy and paste the above code into the code module for the UserForm.
- Return to Microsoft Excel (Alt+Q).
- Save the workbook.
Sample Workbook: Download