One of the form controls you can place in your worksheet is called a list box. This is a scrollable list of options from which the user can choose. You might use these in a worksheet if you have a group of options from which you want the user to choose. Let's assume you have a worksheet that provides a price quote and the price is contingent on which colour of widget the user wants. Having the users type the name of a colour is open to error. For instance, they might enter the name of a colour you don't carry, misspell the colour name, or refer to a colour as "gray" when your terminology is "slate." Rather than have them type a colour in, you can present the various colours in a list from which they can choose.
To place a list box control in your worksheet, display the Developer tab of the ribbon, click the Insert tool (in the Controls group), and then click the List Box tool in the Form Controls section. You then use the mouse to define the rectangle that will hold the list box and the scroll bar at the right side of the box.
To use a list box effectively, you must link it to two separate areas on your worksheet. The first is called an input list, the options in the list. The second is the cell link, which contains the currently selected option. To set these areas, follow these steps:
- Choose the list box control (the one you placed on your worksheet) by clicking on it once.
- Click on the Properties tool in the Controls group on the Developer tab of the ribbon. Excel displays the Format Control dialog box.
- Make sure the Control tab is selected.
- In the Input Range field, supply the name or address of the cell range that contains the options to be included in the list box.
- In the Cell Link field, specify the cell that will contain the value indicating which option is selected.
- In the Selection Type portion of the dialog box you can specify how many options in the list can be selected at the same time. When you use list boxes on a regular Excel worksheet, it is important to leave this option set to Single. The other options only have meaning if you are creating a custom dialog box.
- Click on OK.
You should note that the Cell Link setting specifies a bi-directional relationship between the cell and the control. This means that a change in the selected option will change the value in the cell, but a change in the cell value will also change which option is selected in the list box. The value stored in the linked cell indicates the number of the option selected in the list. Thus, if you have a list of seven options and the second option in the list is selected, the value in the linked cell will be 2.