Excel 2019’s UserForm lets you build interactive dialog boxes with combo boxes (dropdown lists) to select data dynamically. This creates reusable forms that pull values from Excel cells, external data, or predefined lists. You’ll need basic VBA knowledge to create and populate it properly, along with access to Excel 2019’s Developer tab.
What You'll Need
- Microsoft Excel 2019 installed on your PC
- Access to the Developer tab (enable it in Excel Options if missing)
- Basic familiarity with VBA (Visual Basic for Applications) editor
- A worksheet with sample data you want to display in the dropdown
- Excel 2019 running on Windows (macOS versions use a different approach)
Step-by-Step
- Enable the Developer Tab:
- Go to File > Options > Customize Ribbon
- Check the "Developer" box in the right pane and click OK
This tab becomes visible in the Ribbon and is required to create UserForms.
- Insert a UserForm:
- Click the Developer tab in Excel
- Select Insert > UserForm (this opens the VBA editor)
- Click OK to create a blank UserForm
The UserForm window appears in the VBA editor. This is where you design your dropdown.
- Add a ComboBox Control:
- In the VBA editor, go to the Form Controls palette (if not visible, click "View > Toolbox")
- Drag a ComboBox from the list and drop it onto your UserForm
- Right-click the ComboBox and select Properties from the shortcut menu
- In the Properties window:
- Set Name to something descriptive like "cboProduct"
- In the Value field, enter a unique name that matches one of your data items (we'll use this later)
- Set Style to 1 (Dropdown) for a true dropdown
- Set BoundColumn to 0 if you're populating from a range
- Populate the ComboBox:
- Choose a cell range from your data that contains the items you want in the dropdown. For example, select cells A2:A10 from your worksheet
- In the VBA editor, go back to your UserForm
- Right-click the ComboBox > Properties > RowSource
- Enter the formula:
="A2:A10"(This tells Excel to use the range A2:A10 as source for the dropdown items)
If you want to use a specific column from a table, set the RowSourceType to 2 (Value) and enter the column index (e.g.,
"1"for the first column). - Add Code to Handle Selection:
- Double-click the ComboBox in your UserForm to automatically insert code
- This opens a new module in the VBA editor with the following code:
Private Sub ComboBox1_GotFocus() End Sub - Replace this with:
Private Sub ComboBox1_Change() MsgBox "Selected: " & ComboBox1.Value 'Add code to perform actions based on selection here End Sub - Add another line to get the entire selected text:
Private Sub ComboBox1_Change() MsgBox "Selected: " & ComboBox1.Text & vbCrLf & "Full value: " & ComboBox1.Value End Sub
The Text property shows the displayed item, while Value shows the underlying cell reference.
- Test Your ComboBox:
- Press Ctrl+F8 to return to the UserForm in Excel
- Use the Design tab to switch between designing and running the form
- Click the combo box and select an item from the dropdown
- Notice the message box appears showing your selected value
Common Mistakes and How to Fix Them
- ComboBox doesn't show items:
- Check the RowSource property matches your data range exactly
- Verify the range is formatted with values (not formulas) in the cells
- Try using a fixed list in the List property if the range approach fails
- Dropdown doesn't work:
- Ensure Style is set to 1 (Dropdown)
- Check that the Caption property is empty or matches your dropdown label
- Items appear when typing:
- This is normal behavior for dropdowns - select the item from the list, not type it
- If unwanted, set Style to 2 (List)
Tips for Advanced Usage
- Dynamic Data Binding:
- Add this code to update the dropdown when your data changes:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A2:A10")) Is Nothing Then ComboBox1.RowSource = "=A2:A10" End If End Sub
- Add this code to update the dropdown when your data changes:
- External Data Source:
- For data from other sheets or workbooks, use relative references like:
"='Sheet2'!A2:A10"
- For data from other sheets or workbooks, use relative references like:
- Combobox with Multiple Selection:
- Set Style to 3 (Multi-Select)
- Use the Items property to manually add items instead of a range
- Large Datasets:
- Set RowSourceType to 2 (Value) if your data is large
- Use dropdowns on a separate sheet to limit the number of items shown
Troubleshooting
If your combo box isn't working as expected, follow this troubleshooting order:
- Check the Visual Basic Editor:
- Make sure you're editing the correct UserForm (right-click the form in Project Explorer)
- Verify all properties (RowSource, Style, Name) are correct
- Test with Simple Data:
- Create a temporary form with just one item to isolate the issue
- Example: Set RowSource to
"="A1"with value in A1 set to "Test"
- Check Event Procedures:
- Ensure you've added code to handle the Change event (ComboBox1_Change)
- Test the event code separately by creating a simple message box
- Excel-Specific Checks:
- Close all Excel instances and restart your computer
- Run Excel in Safe Mode to check for add-ins interfering
- Try creating the form in a new workbook
- If Still Not Working:
- Reset the UserForm by deleting it and recreating in a new workbook
- Reinstall Excel 2019 or update to the latest version
- Contact Microsoft Support with your error message and steps
Frequently Asked Questions
How do I add multiple items to a combo box programmatically?
Use the Items.Add method in VBA:
- Add this code to your Form module:
Private Sub UserForm_Initialize()
ComboBox1.Items.Add "Option 1"
ComboBox1.Items.Add "Option 2"
ComboBox1.Items.Add "Option 3"
Can I make the combo box select data from an external workbook?
Yes, use relative references in the RowSource property:
- Reference the external workbook in your RowSource:
"='OtherWorkbook.xlsx'!A2:A10" - Make sure the external workbook is open when the form runs
What if I need to handle the selection in a worksheet?
Use this approach to update a cell when selection changes:
- Add this code to your Form module:
- This updates cell B2 with the selected value and makes it bold
Private Sub ComboBox1_Change()
Range("B2").Value = ComboBox1.Value
Range("B2").Font.Bold = True
End Sub
How do I clear a combo box selection programmatically?
Use this simple VBA command:
- In your code module, add:
- This clears both the underlying data reference and the displayed text
ComboBox1.Value = ""
ComboBox1.Text = ""
What if my combo box items appear out of order?
The order depends on your RowSource type:
- For ranges, items appear in the order of the cells referenced
- For lists, order is determined by the Add/Items.Add method calls
- To sort, use Sorted=True in the RowSourceType property (requires Value type)
How can I connect a combo box to a database?
For database connections, you would need to:
- Use ActiveX Data Objects (ADO) in VBA
- Set up a connection string to your database
- Create a Recordset object to fetch data
- Populate the combo box from the Recordset
This requires more advanced VBA knowledge and isn't covered in basic UserForm creation.