About the List Box control

Following are a few points to keep in mind when working with ListBox controls. Examples in the sections that follow demonstrate many of these points:

■ The items in a ListBox can be retrieved from a range of cells (specified by the RowSource property), or they can be added by using VBA code (using the Additem method).

■ A ListBox can be set up to allow a single selection or a multiple selection. This is determined by the

MultiSelect property.

■ If a ListBox is not set up for a multiple selection, the value of the ListBox can be linked to a worksheet cell by using the ControlSource property.

■ It's possible to display a ListBox with no items selected (the Listindex property will be -1 ). However, afte an item is selected, the user cannot deselect all items. The exception to this is if the MultiSelect property is True .

■ A ListBox can contain multiple columns (controlled by the ColumnCount property) and even a descriptive header (controlled by the ColumnHeads property).

■ The vertical height of a ListBox displayed in a UserForm window isn't always the same as the vertical height when the UserForm is actually displayed.

■ The items in a ListBox can be displayed either as check boxes (if multiple selection is allowed) or as option buttons (if a single selection is allowed). This is controlled by the ListStyle property.

For complete details on the properties and methods for a ListBox control, consult the Help system.

0 0

Post a comment