In this video I show you to create a drop-down list in Excel that lets you select multiple items. Download the featured file here. Please note the featured file does not contain the VBA code required to complete the task. Unfortunately, WordPress does not allow me to upload macro-enabled workbooks.
Step 1: Create a List of Values and Name It
In the video I create a list of values that I wanted to appear in the drop-down list on a separate worksheet. I also name the list.
To name a list:
- Select the cells in the list
- Click in the Name Box [just to the left of the formula bar it displays the cell address of the active cell by default]
- Type a name that starts with a letter and does not contain spaces
- Press the Enter key on your keyboard to confirm
Step 2: Create the Drop-down List Using Data Validation
The next step is to create the drop-down list. I did this on a separate worksheet to the list created above in step 1, although it could be created on the same worksheet. To create the drop-down list:
- Select the cell or cells you want the drop-down list to appear in
- Click on the Data tab on Excels ribbon
- Click on the Data Validation button in the Data Tools group
- In the Data Validation dialog, in the Allow: list select List
- Click in the Source: box
- Press F3 on your keyboard to open the Paste Name dialog
- Select the name you gave your list in Step 1
- Click on OK
- Click OK in the Data Validation dialog
By default a drop-down list will only allow you to select one item.
STEP3: Add the VBA Code to Your Drop-Down List
To add the VBA [visual basic for applications] code to your drop-down list follow these steps:
- Use the keyboard shortcut ALT F11 to open the Visual Basic Editor [VBE]
- Make sure the Project Explorer is visible it displays all the workbooks worksheet names. If you cant see it, use the keyboard shortcut CTRL R to open it.
- In the Project Explorer select the worksheet that contains your drop-down list.
- In the Code window [thats the big white area to the right of the Project Explorer], paste the code below
- Close the VBE and you should find that you can select multiple items in your drop-down list.
There are a few tweaks to the code that you make and I go through these in the video. One thing you should note is that the code, as it is, assumes you drop-down is in cell A2. If it isnt, change the range address in line 6.
Please note, when you save the worbook, because it now contains VBA code, it needs to be saved as a Macro-enabled Workbook [*.xlsm].