List Box control

The ListBox control presents a list of items from which the user can choose one or more. Figure 17-10 shows a dialog box with two ListBox controls.

Figure 17-10:

ListBox controls.

Figure 17-10:

ListBox controls.

ListBox controls are very flexible. For example, you can specify a worksheet range that holds the ListBox items, and the range can consist of multiple columns. Or you can fill the ListBox with items by using VBA code.

The following is a description of the most useful ListBox control properties:

1 BoundColumn: If the list contains multiple columns, this property determines which column contains the returned value.

1 ColumnCount: The number of columns in the list.

1 ControlSource: A cell that stores the value selected in the ListBox.

1 IntegralHeight: This is True if the ListBox height adjusts automatically to display full lines of text when the list is scrolled vertically. If False, the ListBox may display partial lines of text when it is scrolled vertically.

1 ListStyle: The appearance of the list items.

1 MultiSelect: Determines whether the user can select multiple items from the list.

1 RowSource: A range address that contains the list of items displayed in the ListBox.

1 Value: The text of the selected item in the ListBox.

^jtSMIf the ListBox has its MultiSelect property set to 1 or 2, then the user can select multiple items in the ListBox. In such a case, you cannot specify a ControlSource; you need to write a macro that determines which items are selected. Chapter 18 demonstrates how to do so.

Was this article helpful?

+1 0

Post a comment