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.

excel vba setup list box

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Sub EnableListBoxMultiSelect()
  3. ActiveSheet.Countries.MultiSelect = fmMultiSelectMulti
  4. 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"


You can find similar Excel Questions and Answer hereunder

1) How can I hide a sheet completely from users (the sheet should not even appear in Unhide dialog box)?

2) How do I assign a macro to a shape using VBA?

3) How do I update my DropDown list whenever the sheet is activated?

4) How do I add a symbol like Triangle / Inverted Triangle for indicating trends in a cell using VBA?

5) How can I change the Marker size and Marker line color for all the series in a chart?

6) How can I shade alternate rows in color using VBA to make it easier to read voluminous data running into hundreds of rows?

7) How can I get input from user through a prompt and assign user's input to a cell?

8) How can I check if a file exists in a folder using VBA?

9) How can I get row count of filtered data?

10) How can I get the count of number of series in a Chart using VBA?

11) How can I create dependent drop down lists?

12) How can I find the last used cell in a Column in VBA?

13) How can I turn off Alerts using VBA?

14) How can I activate a routine when there is a change in value of a cell?

15) How can I list all files in a folder using VBA?