Microsoft Office Tutorials and References
In Depth Information
ListBox Techniques
Working with multicolumn ListBox controls
A normal ListBox has a single column for its contained items. You can, however, create a ListBox
that displays multiple columns and (optionally) column headers. Figure 14-14 shows an example
of a multicolumn ListBox that gets its data from a worksheet range.
This example, named listbox multicolumn1.xlsm , is available on the companion
CD-ROM.
Figure 14-14: This ListBox displays a three-column list with column headers.
To set up a multicolumn ListBox that uses data stored in a worksheet range, follow these steps:
1.
Make sure that the ListBox’s ColumnCount property is set to the correct number of
columns.
2.
Specify the correct multicolumn range in the Excel worksheet as the ListBox’s
RowSource property.
3.
If you want to display column headers, set the ColumnHeads property to True .
Do not include the column headings on the worksheet in the range setting for the
RowSource property. VBA will instead automatically use the row directly above the first
row of the RowSource range.
4.
Adjust the column widths by assigning a series of values, specified in points ( 1 72 of one
inch) and separated by semicolons, to the ColumnWidths property.
 
Search JabSto ::




Custom Search