The List Boxes in VBA for Excel
|
613-749-4695 (Peter) |
Tips and Ideas on Excel |
Tips and Ideas on Macros |
VBA Chapter 24E of 24: The List Boxes in VBA for Excel If you are looking for a drop-down list to use on a regular worksheet see the much easier and user friendly Excel drop-down list. In the toolbox the list box has this icon . Properties - RowSource
The values that should appear in the drop-down list of the combo
box are submitted in the RowSource property. For example
Sheet1!A1:A12 will feed the list with the values residing in cells
A1 to A12 of the sheet with the Caption "Sheet1" .
The rules to submit the RowSource property is the caption
of the sheet where the list resides followed by an exclamation mark
(!), the address of the first cell, a colon and the address if the
last cell. IMPORTANT NOTE: if there is a space or a special
character in the caption of the sheet where the list resides you
must surround it with simple quotes like in 'This sheet'!A1:A12. - ColumnCount
is the number of columns of values that you want shown in the list
box. For example if you want to show part number and part name in
the list you will submit a RowSource like Sheet1!A1:B12 with the
part numbers in column A and the part names in column B |
Next Chapter: Programming Option Buttons in VBA for Excel |
VBA Table of Contents |
Discover Even More in 50 Excel spreadsheets |
|
613-749-4695 (Peter) |
Tips and Ideas on Excel |
Tips and Ideas on Macros |
The List Boxes in VBA for Excel