Excel UserForm ListBox: Format & Control Guide

VBA & macros · Updated November 23, 2026

To format an Excel UserForm ListBox, you set its properties in the VBA editor’s Properties window (e.g., ColumnCount, ColumnWidths, ListStyle, BoundColumn) and, for dynamic styling, you write VBA code that runs when the form initializes or when the list changes. The most common formatting tasks are changing column widths, choosing single or multi-select, setting the number of columns, and controlling how selected items are displayed.

What the ListBox Control Actually Is

A ListBox is a UserForm control that displays a scrollable list of items. Unlike a ComboBox, it shows multiple items at once and allows selecting one or more (depending on the MultiSelect property). The control is part of the ActiveX controls available in the VBA toolbox, not a worksheet control. You add it by opening the Visual Basic Editor (Alt+F11), inserting a UserForm, and dragging the ListBox icon from the Toolbox onto the form.

The ListBox stores its items in a List property (a 2D array) or you can add items one by one with AddItem. Formatting refers to how that data appears: column count, widths, fonts, colors, and selection behavior.

Key Formatting Properties (Set in the Properties Window)

Select the ListBox on the UserForm, then press F4 to open the Properties window. The following properties directly affect formatting:

  • ColumnCount – Number of columns displayed. Set to 1 for a simple list, or 2+ for a table-like display. Data comes from a 2D array or a worksheet range.
  • ColumnWidths – A string of numbers separated by semicolons, e.g., "50;80;120". Each number is the width in points for that column. Leave blank to auto-size.
  • ListStyle – 0 - Plain shows text only; 1 - Option shows a checkbox or radio button beside each item (useful with MultiSelect).
  • MultiSelect – 0 - None (single select), 1 - Simple (click toggles), 2 - Extended (Ctrl+click and Shift+click).
  • BoundColumn – Which column’s value is returned by the Value property. Default is 1. If you have hidden columns, set this accordingly.
  • Font – Click the ellipsis to set font name, size, bold, etc. Applies to all items.
  • BackColor / ForeColor – Background and text colors. Use the palette or enter a hex value.
  • SpecialEffect – 0 - Flat, 1 - Raised, 2 - Sunken, etc. Changes the border look.

These properties are static; they apply to the whole control. For per-item formatting (like coloring a specific row), you need code.

Formatting Columns and Data Source

To show multiple columns, you must populate the ListBox with a 2D array or a worksheet range. For example, with a worksheet range A1:C10 containing names, ages, and cities:

Private Sub UserForm_Initialize()
    Me.ListBox1.ColumnCount = 3
    Me.ListBox1.ColumnWidths = "80;40;100"
    Me.ListBox1.RowSource = "Sheet1!A1:C10"  ' or use .List property
    ' Alternative: Me.ListBox1.List = Sheet1.Range("A1:C10").Value
End Sub

The RowSource property ties the ListBox directly to a worksheet range. However, it only works with contiguous ranges and does not allow per-item formatting changes easily. The .List method loads a 2D array, which is more flexible for dynamic data. If you use .List, set ColumnCount to the number of columns in the array.

To hide a column, set its width to 0 in ColumnWidths. For example, "0;80;100" hides the first column. The BoundColumn then lets you retrieve the hidden value.

Dynamic Formatting with VBA (Per-Item Colors and Fonts)

The ListBox has no built-in event to change the color of a single item. However, you can simulate it by using the ListStyle = 1 (Option) and then using the BeforeDragOver event? That doesn’t work. Instead, the common approach is to use the ListBox1.DrawItem event? That event does not exist for UserForm ListBoxes. Actually, the only way to change per-item appearance is to use the ListBox1.ListIndex and then set the control’s ForeColor or BackColor when the selection changes, but that affects all items, not just one.

A practical workaround is to use a separate label or a second ListBox to show details of the selected item. For true per-item formatting, you would need to use a ListView control (from the Windows Common Controls) which supports ItemData and ListItems with individual colors. But that requires adding a reference to MSComctlLib. For most UserForm needs, the standard ListBox with uniform formatting is sufficient.

To change the font or color of the entire control based on a condition, you can do it in the Change event:

Private Sub ListBox1_Change()
    If ListBox1.ListIndex >= 0 Then
        If ListBox1.List(ListBox1.ListIndex, 1) > 30 Then ' age column
            ListBox1.ForeColor = vbRed
        Else
            ListBox1.ForeColor = vbBlack
        End If
    End If
End Sub

This changes the text color of all items, not just the selected one. To highlight only the selected row, you can’t do it directly; consider using a ListView or a grid control.

Common Formatting Problems and Fixes

  • Columns not showing – Ensure ColumnCount is set to the correct number and that you have loaded data with enough columns. If using RowSource, the range must include all columns.
  • Column widths not applying – Set ColumnWidths after setting ColumnCount. Also, if you set ColumnWidths in the Properties window, it should work immediately. If not, check for semicolons vs. commas (must be semicolons).
  • MultiSelect not working – Set MultiSelect to 1 or 2. Note that ListIndex returns -1 when multiple items are selected; use Selected(i) to check each item.
  • ListBox appears blank – If you use .List in the Initialize event, make sure the UserForm is loaded (not just shown) before the event fires. Also, if the form is modal, the Initialize event runs before the form is visible, so it’s fine.
  • Text is cut off – Increase the width of the ListBox or adjust ColumnWidths to give more space. You can also set IntegralHeight = False to allow partial rows, but that can look odd.

Formatting for Different Versions (Mac and Excel for the Web)

The VBA UserForm is only available in the Windows desktop version of Excel. On a Mac, VBA UserForms exist but have limited functionality; many properties like SpecialEffect may not work. Excel for the web does not support VBA or UserForms at all. If you need a similar list interface on Mac or web, consider using a worksheet with data validation dropdowns or a ListBox as an ActiveX control on the worksheet (which also doesn’t work on Mac). For cross-platform, use a ComboBox from the Form Controls (works on Mac) but it lacks multi-column formatting.

Alternatives to the ListBox for Better Formatting

If you need advanced formatting (per-row colors, icons, sorting), consider these alternatives:

  • ListView Control – From the Microsoft Windows Common Controls (MSComctlLib). Add via Tools > Additional Controls. Supports ColumnHeaders, ListItems with ForeColor and BackColor per item, and View = 3 - lvwReport for a table look.
  • MSFlexGrid or MSHFlexGrid – Grid controls that allow cell-level formatting. They are not true listboxes but can display tabular data with colors.
  • Worksheet ListBox (ActiveX) – Place a ListBox on a worksheet, but formatting is limited and it’s not as flexible as a UserForm.
  • Data Validation Dropdown – For simple single-column lists, this is the easiest and works on all platforms, but no multi-column.

For most simple tasks, the standard ListBox with ColumnCount and ColumnWidths is sufficient. For complex UIs, a ListView is the better choice.

Frequently Asked Questions

How do I make a ListBox with two columns and different widths?

Set ColumnCount = 2 and ColumnWidths = "80;120" (adjust numbers). Then populate with a 2D array or a worksheet range. For example, ListBox1.List = Range("A1:B10").Value.

Why is my ListBox showing only one column even though I set ColumnCount?

You must also load data with that many columns. If you use AddItem only, it adds to the first column. Use .List or RowSource to fill multiple columns. Also, ensure ColumnWidths is not set to a single value that makes other columns zero width.

Can I change the font size of only one item in a ListBox?

No, the standard ListBox applies one font to all items. To have different fonts per row, use a ListView control, which supports per-item font properties.

How do I get the selected value from a multi-column ListBox?

Use ListBox1.Value to get the value of the BoundColumn (default 1). To get a specific column’s value, use ListBox1.List(ListBox1.ListIndex, columnIndex) where columnIndex is zero-based. For multi-select, loop through ListBox1.Selected(i).

Does the ListBox work on Excel for Mac?

Yes, but with limitations. VBA UserForms exist on Mac, but some properties like SpecialEffect and ListStyle may not behave identically. For best compatibility, test on your target platform. Excel for the web does not support VBA.

How do I clear a ListBox and repopulate it?

Call ListBox1.Clear to remove all items. Then repopulate using .List or AddItem. If you used RowSource, clearing is not needed; just change the range or set RowSource to an empty string.

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.