List

Instead of prompting the user to enter a specific value in a text box, sometimes it's better to present him with a list of available choices from which to select. The list box reduces the possibility of data entry errors. The list box entries can be typed in a worksheet or loaded directly from a VBA procedure using the AddItem method. The RowSource property indicates the source of data displayed in the list box. For example, the reference $A$1: $B$8 will display in the list box the contents of the specified range of cells.

The list box can display one or more columns when you set the Column-Count property. Another property, ColumnHeads, can be set to True to display the column titles in the list box. The user is not limited to selecting just one option. If the procedure requires that two or more list items be selected, you can set the MultiSelect property to True.

0 0

Post a comment