Excel UserForm ListBox: Add, Fill, and Get Selected Values

VBA & macros · Updated November 23, 2026

An Excel UserForm ListBox is a control that displays a scrollable list of items and lets the user select one or more of them; you add it to a UserForm from the Toolbox, fill it with the AddItem method or the List property, and read the selection using the ListIndex or List property in VBA. This article covers the full workflow: inserting the control, populating it, handling selection, and common troubleshooting.

What Is a UserForm ListBox and When to Use It

A ListBox is one of the standard ActiveX controls available in the Visual Basic Editor (VBE) for Excel. It appears as a box with a vertical scrollbar, and each line holds one item. You use it when you want the user to pick from a predefined set of values—for example, choosing a department, a product name, or a date range. Unlike a ComboBox, a ListBox shows several items at once without needing a dropdown click, which is better when the list is short (under about 20 items) or when you want the user to see all options simultaneously.

ListBoxes support single selection (the default) and multi-selection via the MultiSelect property. Single selection is standard for simple pickers; multi-select is useful for things like choosing multiple categories to include in a report.

How to Add a ListBox to a UserForm

  1. Press Alt+F11 to open the VBA editor (on Mac: Fn+Option+F11).
  2. In the Project Explorer, right-click your workbook name, choose Insert > UserForm.
  3. If the Toolbox is not visible, go to View > Toolbox.
  4. Click the ListBox icon (it looks like a small list with lines) and then click and drag on the UserForm to draw the control.
  5. With the ListBox selected, press F4 to open the Properties window. Set the Name property to something meaningful like lstProducts.

The control appears on the form immediately. You can resize it by dragging its handles. To test the form, press F5 while the VBE is active, or run the form from a macro using UserForm1.Show.

Filling a ListBox with Items

You populate a ListBox in the UserForm’s Initialize event, which runs when the form is loaded. There are two main methods.

Method 1: AddItem – adds one item at a time:

Private Sub UserForm_Initialize()
    With lstProducts
        .AddItem "Laptop"
        .AddItem "Mouse"
        .AddItem "Keyboard"
        .AddItem "Monitor"
    End With
End Sub

Method 2: List property – assign an array or a range in one line. For a range, use the List property with a 2D array:

Private Sub UserForm_Initialize()
    ' Assumes Sheet1 has product names in A1:A10
    lstProducts.List = Sheet1.Range("A1:A10").Value
End Sub

The .Value returns a 2D array, which the ListBox accepts directly. If your range is horizontal (e.g., A1:C1), the ListBox will still fill correctly because it transposes automatically when the array is 1 row by multiple columns.

You can also fill from a named range or a table column: lstProducts.List = Range("ProductList").Value.

Getting the Selected Value or Values

To find out what the user selected, use the ListIndex property (returns the index of the selected item, starting at 0) and the List property to get the actual text. For single selection:

Dim selectedValue As String
If lstProducts.ListIndex > -1 Then
    selectedValue = lstProducts.List(lstProducts.ListIndex)
    MsgBox "You chose: " & selectedValue
Else
    MsgBox "No selection made."
End If

For multi-select, set MultiSelect to 1 – fmMultiSelectMulti or 2 – fmMultiSelectExtended in the Properties window. Then loop through all items checking the Selected property:

Dim i As Long
Dim selectedItems As String
For i = 0 To lstProducts.ListCount - 1
    If lstProducts.Selected(i) Then
        selectedItems = selectedItems & lstProducts.List(i) & vbNewLine
    End If
Next i
If Len(selectedItems) > 0 Then
    MsgBox selectedItems
Else
    MsgBox "Nothing selected."
End If

Note that ListIndex returns -1 if nothing is selected. In multi-select mode, ListIndex returns the index of the last item clicked, not a complete set—always loop with Selected for multi-select.

Common Properties and Their Effects

  • MultiSelect – 0 (single), 1 (simple multi), 2 (extended with Shift/Ctrl).
  • ListStyle – 0 (plain), 1 (option buttons or checkboxes). For multi-select, set to 1 to show checkboxes.
  • ColumnCount – if you want multiple columns, set this to the number of columns and assign a 2D array to List. The ColumnWidths property controls column widths (e.g., “60;80”).
  • BoundColumn – when using multiple columns, this defines which column’s value is returned by ListIndex when you use List(ListIndex, BoundColumn).
  • RowSource – you can also set this to a range address like “Sheet1!A1:A10” in the Properties window, but this method is less flexible for dynamic lists.

For a two-column example, put data in A1:B10, set ColumnCount = 2, and in Initialize: lstProducts.List = Sheet1.Range("A1:B10").Value. The user sees both columns, and you can retrieve the second column value with lstProducts.List(lstProducts.ListIndex, 1) (column index 0 is first column).

Common Problems and How to Fix Them

ListBox appears empty when the form runs. This usually happens because the Initialize event isn’t firing or the code is in the wrong place. Make sure the code is in the UserForm’s code module (double-click the form background to open it) and that you’re using the UserForm_Initialize subroutine. Also check that the form is shown with UserForm1.Show and not just created.

Items disappear after you close and reopen the form. That’s normal—the ListBox is populated every time the form initializes. If you want to persist selections, store them in a worksheet or a global variable.

MultiSelect doesn’t work. You must set MultiSelect to a non-zero value in the Properties window before running the form. Also, if you use ListIndex to read the selection in multi-select, you’ll only get the last clicked item—use the loop method above.

ListBox is too small or too large. Adjust the Height and Width properties. To show more items, increase the height; the scrollbar appears automatically when the list exceeds the visible area.

Cannot click on items. If the ListBox is behind other controls, bring it to front with Format > Bring to Front in the VBE toolbar. Also check that the form’s Enabled property is True.

Alternatives to a UserForm ListBox

If you don’t want to use VBA, you can use a worksheet ListBox control from the Forms toolbar (Developer tab > Insert > List Box (Form Control)). That control works directly with a linked cell and a range, without code. However, it’s less flexible for multi-column display and dynamic content.

Another alternative is the Data Validation dropdown in a cell, which is simpler but only allows one selection and cannot be used in a UserForm. For complex forms, a ListBox is usually the right choice because it gives you full control over appearance and behavior.

Frequently Asked Questions

How do I clear a ListBox in VBA?
Use lstProducts.Clear to remove all items. If you need to clear only selected items, loop through and set Selected(i) = False for each index.

Can I sort the ListBox items alphabetically?
You can sort the source array before assigning it, or use the List property with a sorted range. There is no built-in Sort method for a ListBox, so sort the data in the worksheet first or use a sorting algorithm in VBA.

How do I get the selected item’s text when using multiple columns?
Use lstProducts.List(lstProducts.ListIndex, columnIndex) where columnIndex starts at 0. For example, lstProducts.List(lstProducts.ListIndex, 1) returns the second column’s value.

Why does my ListBox show only the first item?
If you set RowSource to a range that is not contiguous or has blank rows, the ListBox may only show the first item. Use the List property with a range that has no blank cells, or use AddItem in a loop.

Can I add a search box to filter the ListBox?
Yes, you can add a TextBox above the ListBox and in its Change event, loop through a hidden array and rebuild the ListBox with matching items. This is a common pattern but requires careful handling of the original data.

Is there a way to select multiple items without holding Ctrl?
Set MultiSelect to 1 – fmMultiSelectMulti; then clicking an item toggles its selection without needing Ctrl. For extended selection with Shift, use 2 – fmMultiSelectExtended.

Conclusion

The UserForm ListBox is a versatile control for building interactive Excel tools. By mastering the AddItem, List, and Selected properties, you can create forms that let users pick from lists, multi-select options, and even display multi-column data. Remember to save your workbook as a macro-enabled file (.xlsm) before adding VBA code, and always test your form by running it with F5.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.