Multicolumn List Box

You've created several spreadsheets containing store data.The primary key of each set is the store number.The workbook is used by several people,but not everyone memorizes stores by their store numbers.You need some way of letting a user select a store by its name, but at the same time, return the store number to be used in the code.You could use vlookup or match, but there's another way.

A ListBox can have more than one column, but not all the columns need to be visible to the user. Also, the user can select an item from the visible list, but the ListBox returns the corresponding value from another column.

Draw a ListBox and set the columncount property to 2. Set the RowSource to a two-column range called Stores. The first column of the range is the store number;the second column is the store name.At this point, the ListBox is displaying both columns of data.To change this, set the column width to 0,20—the text automatically updates to 0 pt;20 pt.The first column is now hidden. Figure 21.17 shows the ListBox properties as they need to be.

Figure 21.17

Setting the ListBox properties creates a two-column ListBox that appears to be a single column of data.

Figure 21.17

Setting the ListBox properties creates a two-column ListBox that appears to be a single column of data.

0 0

Post a comment