vba setup list box in Excel
Q194. In Excel, how can I set up ListBox using VBA to allow users to select multiple values?
For example, I have a Activex listbox "Countries". I want to allow users to select more than one country in the list.
To do it in Excel, here is the answer:
- Option Explicit
- Sub EnableListBoxMultiSelect()
- ActiveSheet.Countries.MultiSelect = fmMultiSelectMulti
- End Sub
a) Line 3 sets up the ListBox to support multiple values selection by user.
b) To support only one value selection, the MultiSelect propert should be set to "fmMultiSelectSingle" instead of "fmMultiSelectMulti"