How to Add a ComboBox in Excel
This is the sample dataset.
Steps:
- Go to the Developer tab >> Insert >> Combo Box (ActiveX Control option).
- Drag an area for the Combo Box in the Excel file.
A combo box will be displayed.
Example 1 – Adding Values as Single Inputs
Enter the employees’ names (displayed in B5:B9):
Steps:
- Double-click the combo box.
- The code window of VB Editor will be displayed.
- Enter the following code and press Ctrl + S.
- In the Microsoft Excel dialog box, click No.
- In Save As, choose .xlsm in Save as type:
- Click Save.
- Click Run.
The values are added to the combo box:
Read More: How to Add Item to ComboBox with VBA in Excel
Example 2 – Adding Values from a Range
Steps:
- Click the combo box.
- Go to the Developer tab and click Properties.
- In the Properties window, enter B5:B9 in ListFillRange.
The values in B5:B9 are displayed in the dropdown list.
Example 3 – How to Remove a ComboBox Value in Excel VBA
Steps:
- Double-click the combo box and go to the code window.
- Use the following VBA code and click Run.
All values are removed from the dropdown.
Example 4 – How to Set a Default ComboBox Value in Excel VBA
To set a default value in D6:
Steps:
- Choose a name to set as default.
- Go to the Developer tab >> View Code.
- Enter the VBA code below and save the file.
- Click Run.
The selected name (Sarah) is displayed in D6.
- Change the employee’s name and you will still see the previous name in D6 by default.
Note:
If you want to change the default value in D6, select a name and run the code again.
Download Practice Workbook
Download the practice workbook.
Related Articles
- How to Use VBA to Populate ComboBox List from Range in Excel
- How to Use Excel VBA ComboBox with Control Source Property
- Excel VBA to Populate ComboBox from Dynamic Range
- Excel VBA ComboBox: Important Properties to Explore
- Create ComboBox with RowSource in Excel VBA
- How to Get Excel VBA Combobox with RowSource Named Range