Support Multiple Lists in a ComboBoxWhen working with multiple lists, you can force a list to change by using a combination of option buttons plus a ComboBox. Excel offers many ways for users to select items from a list, be they names, products, days of the week-whatever the list is composed of. However, to access more than one list of choices simultaneously generally requires that you use three separate controls, such as three ComboBox controls from the Forms toolbar. Instead, you can use a ComboBox in combination with option buttons (also called radio buttons and also found on the Forms toolbar) to have a list change automatically according to which option button you choose. To see how this works, enter the numbers 1 through 7 in the range A1:A7 on a new worksheet. In B1:B7, enter the days of the week starting with Monday and ending with Sunday. In C1:C7, enter the months January through July.
Select View Now, click the ComboBox and again click somewhere on the spreadsheet to insert a ComboBox on it. Using the drag handles, size the ComboBox to a manageable size and position the option buttons so that they're directly below the ComboBox. Left-click the first option button, select Edit Text, then replace the words Option Button 1 with the word Numbers. Use the same process for Option Button 2, replacing with the word Weekdays, and for Option Button 3, replacing with the word Months. This is shown in Figure 2-8. While holding down the Ctrl key, click each option button so that all three are highlighted, then right-click and select Format Control In cell E6, enter the following formula: =ADDRESS(1,$F$1)&":"&":"ADDRESS(7,$F$1) Select Insert =INDIRECT($E$6) Click Add, and then click OK. Right-click the ComboBox and select Format Control Figure 2-8. A multilist ComboBox controlled by option buttons
When setting this up for your own spreadsheet, you should use some offscreen cells for the ComboBox links and lists. You might even want to hide these cells from users so that your links stay where they should. Also, you need to modify the two ADDRESS functions to reflect the cell range you are using. In the ADDRESS functions we used in this example, 1 represents the first row number of the lists, while 7 represents the last row number. |
