Populate Multiple Columns in an Excel VBA ListBox
Question details
Display a primary value and additional information in a multiselect Excel VBA ListBox, then retrieve the first-column values from selected rows.
- Product
- Microsoft Excel VBA UserForm ListBox
- Device & OS
- not provided
- Scenario
- A single-column ListBox currently uses worksheet values and AddItem. The user wants to display a second column and adapt the code that copies selected values into worksheet cells.
- Observed behavior
- The ListBox populates, but the selection-handling code needs an explicit column index to retrieve the first-column value.
Confirm the UserForm control is named ListBox1 and that Sheet1!A2:B20 contains the two columns you want to display. Open the Visual Basic Editor and use the UserForm's code module for statements that reference Me.ListBox1.
Populate a two-column ListBox from a worksheet range
Use RowSource to display adjacent worksheet columns without adding each item individually.
In Excel, place the primary values in Sheet1 cells A2:A20 and the related information in B2:B20. Keep column headings outside this source range.
In the Visual Basic Editor, open the UserForm designer, select ListBox1, and open its Properties window. Set ColumnCount to 2, BoundColumn to 1, and MultiSelect to 1 - fmMultiSelectMulti or 2 - fmMultiSelectExtended.
Open the UserForm code module and add the following initialization procedure, or merge these statements into the existing one: Private Sub UserForm_Initialize() With Me.ListBox1 .ColumnCount = 2 .BoundColumn = 1 .ColumnWidths = "100 pt;150 pt" .RowSource = "Sheet1!A2:B20" End With End Sub Replace the sheet name and range with your actual source. Remove the old AddItem population loop when switching to RowSource.
Run the UserForm and check that each row displays the primary value and its related information. If the second column is clipped, widen ListBox1 in the designer or adjust ColumnWidths.
Retrieve and copy first-column values from selected rows
Use an explicit column index and check each row's Selected property when processing multiple selections.
Manage worksheet lists in WPS Spreadsheet
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Excel format compatibility for easy migration of worksheet data. Use WPS Spreadsheet to organize the source and output tables; it is not a fix for Excel VBA UserForm behavior, and this macro workflow requires a compatible VBA environment.

Frequently Asked Questions
Why does my ListBox show only one column when the source range has two?
Select ListBox1 in the UserForm designer and set ColumnCount to 2. Also check ColumnWidths: the second column must have a nonzero width, and the control must be wide enough to display it.
How do I retrieve the second-column value from a selected row?
Use Me.ListBox1.List(ii, 1), where ii is the row index. List uses zero-based column indexes, so 0 is the first column and 1 is the second.
Can I keep using AddItem after setting RowSource?
No. A ListBox bound through RowSource cannot be populated with AddItem. Remove the AddItem loop when using RowSource, or clear RowSource and use an unbound population method instead.
What if my worksheet name contains spaces?
Enclose the worksheet name in single quotation marks inside the RowSource string. For example, use Me.ListBox1.RowSource = "'Country Lists'!A2:B20".
Does BoundColumn = 1 automatically return every selected first-column value?
No. BoundColumn identifies the bound column, but it does not collect multiple selections. Loop from 0 to ListCount - 1, check Me.ListBox1.Selected(ii), and retrieve each selected value with Me.ListBox1.List(ii, 0).




