Microsoft Office Tutorials and References
In Depth Information
Multiple lists in a single ListBox
This example demonstrates how to create a ListBox in which the contents change depending on
the user’s selection from a group of OptionButtons.
Figure 14-11 shows the UserForm. The ListBox gets its items from a worksheet range. The
procedures that handle the Click event for the OptionButton controls simply set the ListBox’s
RowSource property to a different range. One of these procedures follows:
Private Sub obMonths_Click()
ListBox1.RowSource = “Sheet1!Months”
Figure 14-11: The contents of this ListBox depend on the OptionButton selected.
Clicking the OptionButton named obMonths changes the RowSource property of the ListBox
to use a range named Months on Sheet1 .
This example, named listbox multiple lists.xlsm , is available on the companion
ListBox item transfer
Some applications require a user to select several items from a list. It’s often useful to create a
new list of the selected items and display the new list in another ListBox. For an example of this
situation, check out the Quick Access Toolbar tab of the Excel Options dialog box.