Select One or More Items from Excel Data Validation Listbox (2023)

Show a pop-up listbox, when a cell with an Excel drop down list is selected. Select multiple items from the list, and all selected items are entered in the active cell. There is also a sample file for single item selection.

Select One or More Items from Excel Data Validation Listbox (2)

Author: Debra Dalgleish

Select Items From Drop Down List

Select Multiple Items from Drop Down

Choose Multiple Items from Listbox

Macro and UserForm

UserForm With Listbox

See Object Properties

UserForm VBA Code

Global Variable

Data Entry Sheet VBA Code

Get the Sample Files

More Tutorials

Select Items From Drop Down List

To make data entry easy, you can follow these steps:

  • Add drop down lists to your worksheets, using the Excel data validation feature
  • Then, select a cell, and click its drop-down arrow
  • Select an item from the drop down list
  • The selected item is automatically entered in the cell

For example, in the screen shot below, there is an Excel table, with drop down lists for Day and Month.

Select "Tuesday" from the drop down list, to add it to the active cell.

Select One or More Items from Excel Data Validation Listbox (3)

Worksheet Lists for Cell Drop Downs

On another worksheet in that Excel file, there are two named lists:

  • DayList - list of weekdays, in cells A1:A7
  • MonthList - list of months, in cells C1:C12

Those lists are used to set up the data validation drop down lists on the data entry sheet.

Select One or More Items from Excel Data Validation Listbox (4)

Named Ranges Required

The multiple selection techniques dexcribed below will only work with drop down lists that are based on a named range.

The macros will not work with data validation drop down lists that are based on the following:

  • worksheet cell reference, such as this range of cells: =Admin_Lists!$A$1:$A$7
  • delimited list entered directly into data validation dialog box, such as: Jan,Feb,Mar

Select Multiple Items from Drop Down

On an Excel worksheet, you can only select one item from a data validation drop down list of items. Later, if you choose a different item from the drop down, the new item replaces the previous selection in the cell.

However, with a bit of Excel programming, you select multiple items, and keep all of them in the cell.

Two Ways to Select Multiple Items

Here are a couple of ways that you can get multiple items into a cell that has a drop-down list.

1) Listbox

One way to select multiple items is with a pop-up Listbox. The instructions for this method are on this page, in the sections below the video.

  • Select multiple items at once, from the listbox
  • All selections are added to the cell, without removing previous selections from the cell

2) In-cell

Another way to select multiple items for a cell, is with VBA code that runs when you select a drop down cell.

  • Select items one at a time, from the drop down list
  • Each new selection is added to the cell, without removing previous items

The short Excel video below shows this in-cell method, and there are detailed instructions on this page: Data Validation Select Multiple Items

Choose Multiple Items from Listbox

To make it easy to select multiple items for a cell, all at once, set up a pop-up listbox in your workbook.

The setup steps are described below, and you can get the completed workbook in the Download section, at the end of this page..

Here's how the completed pop-up listbox works:

  • On the worksheet, click on a cell that has a drop down list
  • The VBA listbox pops up automatically, and shows all the choices from the cell's drop down list.
  • Add a check mark to one or more of the items in the list box
  • When you're finished selecting items, click the OK button.

Select One or More Items from Excel Data Validation Listbox (5)

All the selected items are added to the active cell, separated by a comma and space character.

Select One or More Items from Excel Data Validation Listbox (6)

Macro and UserForm

The sample workbook, that you can get in the Download section, uses VBA macros.One macro is an Event procedure, and it runs automatically, when you click a cell (that's an event) on the worksheet.

There is also an Excel UserForm in the workbook, with a listbox and two buttons

To see the code and the UserForm, follow these steps:

  • Right-click the sheet tab for the DataEntry sheet
  • In the pop-up menu, click on View Code.

Visual Basic Editor

The Visual Basic Editor opens, and you should see 3 windows

  • Project Explorer - at the top left - shows all open workbooks, and the objects in them
  • Properties - at the bottom left - details about the selected object
  • Code - at the top right - code for the selected object

In the screen shot below:

  • DataEntry sheet is the selected object, and its code is showing in the Code window.
    • The code is shown and explained in a later section, below
  • In the Project Explorer, I've highlighted the UserForm, which is named frmDVList.
    • If necessary, click the plus sign to the left of a folder icon, to see the objects inside it

Select One or More Items from Excel Data Validation Listbox (7)

UserForm With Listbox

In the screen shot above, you can see the UserForm object, in the Project Explorer.

NOTE: To build your own UserForm and ListBox, see instructions here: Create UserForm with ListBox

To see the UserForm in design mode:

  • Double-click on the UserForm in the Project Explorer window.
  • The UserForm appears in the Object window, , where the Code window was, previously.

Select One or More Items from Excel Data Validation Listbox (8)

See Object Properties

When an object is selected in the Project Explorer, or in the Object window, you can see that object's details in the Properties window.

In the screen shot below:

  • UserForm is selected in the Object window.
    • It has a thick grey outline, with a square black handle at its bottom left corner.
  • At the top of the Properties window, you can see the name that I gave to the UserForm - frmDVList
    • I used that name because it will show a pop-up data validation list.
  • You can slso see the form's name at the top of the list of properties: (Name) - frmDVList
    • At any time, you can change the form's name, or any of the other properties in the list
  • In the Caption property, you can see the text that appears at the top of the UserForm - Select Items to Add

Select One or More Items from Excel Data Validation Listbox (9)

ListBox Properties

On the UserForm, there are two command buttons, and a Listbox.

To see the ListBox properties, click the ListBox in the Object window

In the screen shot below:

  • ListBox is selected in the Object window.
    • It has a thick grey outline, and white handle at its bottom centre (not visible in screen shot)
  • At the top of the Properties window, you can see the name that I gave to the ListBox - lstDV
    • I used that name because it will show items from the data validation list.

Select One or More Items from Excel Data Validation Listbox (10)

ListBox Property Settings

Here are some of the other ListBox property settings that I used, and you can see all the settings if you download the sample file.

Note: The MultiSelect property setting is most important!

  • ColumnCount: 1
  • ColumnHeads: False (do not show column headers in list)
  • ListStyle: 1 - fmListStyleOption (this shows checkbox or radio buttons)
  • MultiSelect: 1 - fmMultiSelectMulti
  • SpecialEffect: 2 - fmSpecialEffectSunken

Note: The RowSource property will be set by the VBA code, after you select a cell with a data validation drop down list.

UserForm VBA Code

In addition to the controls on the UserForm (ListBox, 2 buttons), there is also VBA code.

To see the UserForm's VBA code:

  • Right-click on the UserForm in the Project Explorer window.
  • Click View Code

There are 3 procedures on the code module, separated by thin black lines

  • cmdClose_Click - runs when you click the Close button (named cmdClose)
  • cmdOK_Click - runs when you click the OK button (named cmdOK)
  • UserForm_Initialize - automatically runs when the UserForm opens

See the details for these 3 procedures, in the sections below.

UserForm Initialize Code

When the form opens, the UserForm_Initialize code sets the RowSource property for the ListBox.

Here is the code, and there is a brief explanation below.

Private Sub UserForm_Initialize() Me.lstDV.RowSource = strDVListEnd Sub

In that short procedure,

  • Me represents the UserForm
  • lstDV.RowSource is the ListBox RowSource property
  • strDVList is a variable, that stores a value temporarily

The strDVList variable gets a list name based on the data validation cell that you clicked. For example, if you clicked a Month cell on the DataEntry sheet, the strDVList variable would be "MonthList"

Close Button VBA Code

When you click the Close button, the following code runs.

There is only one line in this procedure, and it unloads the UserForm, which means that you can't see it or interact with the UserForm any longer:

Private Sub Sub cmdClose_Click() Unload MeEnd Sub

OK Button VBA Code

When you click the OK button, the following code runs.

This code gets all the selected items from the ListBox, and copies them to the active cell. At the end, the code unloads the UserForm, so the pop-up ListBox is hidden again.

Note: There are comments in the code, to describe what the macro does.

Private Sub cmdOK_Click()Dim strSelItems As StringDim lCountList As LongDim strSep As StringDim strAdd As StringDim bDup As BooleanOn Error Resume NextstrSep = ", " 'separator for items in cellWith Me.lstDV 'go through all items in list ' numbering starts at zero For lCountList = 0 To .ListCount - 1 'if item is selected, get item name ' strAdd variable is item name ' or empty string If .Selected(lCountList) Then strAdd = .List(lCountList) Else strAdd = "" End If 'if no previous items, ' strSelItems =strAdd If strSelItems = "" Then strSelItems = strAdd Else 'if prev items, add separator ' and latest item If strAdd <> "" Then strSelItems = strSelItems _ & strSep & strAdd End If End If Next lCountListEnd WithWith ActiveCell 'if active cell is not empty, add separator ' and all items collected from ListBox If .Value <> "" Then .Value = ActiveCell.Value _ & strSep & strSelItems Else 'if active cell empty, and all items ' collected from ListBox .Value = strSelItems End IfEnd WithUnload MeEnd Sub

Global Variable

There is one regular code module, named modSettings, in the sample workbook.

That module has one line of code, to define a global variable.

 Global strDVList As String

That variable is used in the UserForm, and in Worksheet VBA code, shown in the next section:

  • Worksheet code gets data validation source list name from active cell
  • That name is passed to the strDVList variable, for temporary storage
  • Then, when UserForm opens, strDVList variable is used as the RowSource for the ListBox
Me.lstDV.RowSource = strDVList

DataEntry Sheet VBA Code

On the DataEntry sheet's code module, you can see the code that runs when you select a different cell.

First, the code checks to see if the cell has data validation list. If so, it gets the source name for the list. Then, it opens the UserForm.

Here is the code, with comments to describe what the macro does.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)Dim rngDV As RangeDim oldVal As StringDim newVal As StringDim strList As StringOn Error Resume Next'temporarily turn off EventsApplication.EnableEvents = False'set a range with all DV cells on sheet Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo exitHandler'if no DV cells, exit macro If rngDV Is Nothing Then GoTo exitHandler If Not Intersect(Target, rngDV) Is Nothing Then 'if active cell IS in DV range 'check if it's a List (DV type 3) If Target.Validation.Type = 3 Then 'if list, get source list name strList = Target.Validation.Formula1 strList = Right(strList, Len(strList) - 1) 'pass source list name to global variable strDVList = strList 'open UserForm frmDVList.Show End If End IfexitHandler:'turn on Events Application.EnableEvents = TrueEnd Sub

Download Sample Files

  1. Multi Select: To try this technique, download the zipped sample file: Select Multiple Items from Listbox. The zipped file is in xlsm format, so enable macros when you open the workbook.
  2. Single Select: There is also a single selection version of the file, that lets you pick one item to enter in the active cell. The zipped file is in xlsm format, so enable macros when you open the workbook.
  3. Combo Multi: This sample file allows multiple selections, and also has a combo box above the list. Start typing in the combo box, and it will autocomplete. Press Enter, to add the combo box item to the list selections. Then, click OK, to add all the selected items to the cell.
  4. 2-Column Listbox: This sample file has a 2-column Listbox, and it allows multiple selections, and also has a combo box above the list. For the Day column, a short day name is also added to the worksheet. Start typing in the combo box, and it will autocomplete. Press Enter, to add the combo box item to the list selections. Then, click OK, to add all the selected items to the cell.

More Tutorials

Data Validation Basics

List Box, Excel VBA

Data Validation - Create Dependent Lists

Data Validation Criteria Examples

Data Validation Tips

Data Validation Combo Box

FAQs

Select One or More Items from Excel Data Validation Listbox? ›

Go to Data –> Data Tools –> Data Validation. In the Data Validation dialogue box, within the settings tab, select 'List' as Validation Criteria. In Source field, select the cells which have the items that you want in the drop down. Click OK.

How do you select multiple items from Data Validation list in Excel? ›

Go to Data –> Data Tools –> Data Validation. In the Data Validation dialogue box, within the settings tab, select 'List' as Validation Criteria. In Source field, select the cells which have the items that you want in the drop down. Click OK.

Can you select multiple in Data Validation? ›

Select Multiple Items From Drop Down List. Instead of limiting the drop down list to a single selection, you can use a bit of programming, combined with the data validation list, and allow multiple selections.

How do I select multiple options in a drop-down list? ›

Selecting multiple options vary in different operating systems and browsers:
  1. For windows: Hold down the control (ctrl) button to select multiple options.
  2. For Mac: Hold down the command button to select multiple options.

Which method is used to select multiple items from listbox? ›

Multiple items are selected by holding down Shift and choosing them with the mouse, or by holding down Shift and pressing an arrow key to extend the selection from the previously selected item to the current item. You can also select items by dragging with the mouse.

Can you select multiple drop down list Excel? ›

How to make Excel drop down with multiple selections
  1. Select one or more cells for your dropdown (D3:D7 in our case).
  2. On the Data tab, in the Data Tools group, click Data Validation.
  3. In the Allow drop-down box, select List.
  4. In the Source box, enter the formula that indirectly refers to Table1's column named Items.
May 5, 2023

How to select multiple options in Data Validation list sheets? ›

Below are the steps to so this:
  1. Select the cell where you want the drop-down list.
  2. Navigate to Data >Data validation.
  3. In Criteria, select Dropdown (from a range) and then select the range that has the items that you want to show in the drop-down.
May 2, 2023

Can you select multiple items from a drop down list in Word? ›

Drop-down list box Like any other list, a drop-down list box offers users a list of choices. However, with drop-down list boxes, the list entries are hidden until the user clicks the control. Users can select only one item from a drop-down list.

How do I get the selected value in multi select dropdown? ›

Using our inbuild value property, we can get the selected value in the multiselect component Please refer to the block of code below.
  1. // Instance created on multiselect component.
  2. var multiselectObj = document.getElementById('ddlFilterEmployee').ej2_instances[0];
  3. // Get the selected value through Value property.
Oct 24, 2019

How to select multiple options from dropdown without select class? ›

Different Methods to handle Dropdown in Selenium without using Select Class
  1. Method 1: By storing all the options in List and iterating through it.
  2. Method 2: By creating Custom Locator and without iterating the List.
  3. Method 3: By using JavaScriptExecutor class.
  4. Method 4: By using sendKeys method.
Jan 18, 2023

How to create dependent drop down list in Excel with multiple selections? ›

How to create multiple dependent dropdown in Excel
  1. Type the entries for the drop-down lists. ...
  2. Create named ranges. ...
  3. Make the first (main) drop-down list. ...
  4. Create the dependent drop-down list. ...
  5. Add a third dependent drop-down list (optional)
Apr 5, 2023

How do I create a dynamic drop down list in Excel? ›

How to make dynamic drop down list in Excel
  1. Get items for the main drop down list. For starters, we shall extract all different fruit names from column A. ...
  2. Create the main drop down. ...
  3. Get items for the dependent drop down list. ...
  4. Make the dependent drop down.
Apr 5, 2023

Which property of the ListBox is used to select multiple values? ›

The SelectionMode property enables you to determine how many items in the ListBox a user can select at one time and how the user can make multiple-selections. When the SelectionMode property is set to SelectionMode.

How to get selected items from ListBox? ›

To determine the items that are selected, you can use the Selected property of the list box. The Selected property of a list box is an array of values where each value is either True (if the item is selected) or False (if the item is not selected).

Which key is used to select more than one option in ListBox? ›

To select multiple items in a list, hold down the Ctrl (PC) or Command (Mac) key. Then click on your desired items to select.

How to select multiple options from a drop down list in Selenium? ›

Example 1- Handling dropdown using Selenium WebDriver
  1. Launch the browser.
  2. Select the Old Style Select Menu using the element id.
  3. Print all the options of the dropdown.
  4. Select 'Purple' using the index.
  5. After that, select 'Magenta' using visible text.
  6. Select an option using value.
  7. Close the browser.
Nov 17, 2021

What is the difference between a list box and a combo box? ›

Generally, a combo box is appropriate when there is a list of suggested choices, and a list box is appropriate when you want to limit input to what is on the list. A combo box contains a text box field, so choices not on the list can be typed in. The exception is when the DropDownStyle property is set to DropDownList.

How do you filter in Excel with multiple values from a list? ›

How to filter in Excel effectively
  1. Select the cell of interest and click Apply Filter by Selected Value.
  2. Filter by selected value is created.
  3. Select several cells and click Apply Filter by Selected Value.
  4. The list is filtered by multiple values.
  5. Clear all filters in one click.

How to do multiple validation in Excel? ›

Re: Excel multiple data validation

Here's how you can do it: Select the cells you want to apply data validation to. Go to the Data tab on the ribbon and click on Data Validation. In the Data Validation dialog box, select Custom from the Allow drop-down list.

How do I add more options to my Data Validation list? ›

Go to Data > Data Validation. On the Settings tab, click in the Source box, and then change your list items as needed. Each item should be separated by a comma, with no spaces in between like this: Yes,No,Maybe.

What is the difference between a listbox and a drop-down list? ›

A standard list box is a box containing a list of multiple items, with multiple items visible. A drop-down list is a list in which the selected item is always visible, and the others are visible on demand by clicking a drop-down button.

How do you select multiple items at once? ›

Windows method one
  1. Click on one of the files or folders you want to select.
  2. Hold down the control key (Ctrl).
  3. Click on the other files or folders that you want to select while holding the control key.
  4. Continue to hold down the control key until you select all the files you want.
Feb 3, 2023

What is the difference between combobox and drop-down list content control? ›

Drop-down list box Like a combo box, a drop-down list box enables users to select a value in a list that is hidden on the form by default. However, with a drop-down list box, users cannot add items to the list as they can with a combo box.

How do I get the selected value from a dropdown list? ›

Get the selected value and text of the dropdown list. If we want to get the selected option text, then we should use the selectedIndex property of the selectbox . The selectedIndex property denotes the index of the selected option.

How to multiselect a dynamically populated dropdown based on another dropdown value selection? ›

It's simple: just add an onClick to call a function every time the options are checked (or unchecked), and then, loop the checkboxes looking for the cheked options, concatenating their texts and showing it at the main label of the select. Same thing is possible if you want to show the number of items selected.

What is the difference between single select and multiple select dropdown? ›

Different selection modes

Single: The user can select only one item at a time. Multiple: The user can select multiple items without using a modifier. Extended: The user can select multiple items with a modifier, such as holding down the SHIFT key.

What is the difference between dropdown and multiple choice? ›

Multiple Choice Fields: A question with a group of answers choices that lets the user select one choice only. Dropdown Menus: A question with an answer fields that expands into a list of options that lets the user select one choice.

How do you select multiple things not in order? ›

Press and hold CTRL. Select the next item that you want.

How to select multiple options in data validation list sheets? ›

Below are the steps to so this:
  1. Select the cell where you want the drop-down list.
  2. Navigate to Data >Data validation.
  3. In Criteria, select Dropdown (from a range) and then select the range that has the items that you want to show in the drop-down.
May 2, 2023

How to select multiple options in data validation list Google sheet? ›

On the Data validation rules panel, under "Criteria," select an option:
  1. Dropdown from a range: Choose the cells to include in the list.
  2. Dropdown: Enter the dropdown value. Click Add another item to add additional dropdown values.

How do I make multiple selections in a drop-down list in Word? ›

Under Insert controls, click Multiple-Selection List Box. If you cleared the Automatically create data source check box in step 3, select a repeating field in the Multiple-Selection List Box Binding dialog box to which you want to bind the multiple-selection list box.

How do I select all cells with data validation? ›

Find cells that have data validation rules
  1. On the Edit menu, point to Find, and then click Go To.
  2. Click Special.
  3. Select Data Validation.
  4. To find all cells with data validation, select All, and then click OK. To find cells that have the same validation rules as another cell, select Same, and then click OK.

References

Top Articles
Latest Posts
Article information

Author: Pres. Lawanda Wiegand

Last Updated: 01/12/2023

Views: 6338

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Pres. Lawanda Wiegand

Birthday: 1993-01-10

Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

Phone: +6806610432415

Job: Dynamic Manufacturing Assistant

Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.