List Box multiple value selection

30,067

When a List Box has its Multi Select property set to "None" then you can retrieve the selected value by simply referring to

Me.List0.Value

However, for multi-select List Box controls you need to iterate through the ItemsSelected collection to determine the items that are selected:

Dim ItemIndex As Variant
For Each ItemIndex In Me.List0.ItemsSelected
    MsgBox Me.List0.ItemData(ItemIndex)
Next
Share:
30,067
Mukul
Author by

Mukul

Updated on September 21, 2020

Comments

  • Mukul
    Mukul over 3 years

    I have created form based on query output. I had used three comboboxes and one list box. First combobox gives me list of Dept, selection of Dept on second gives me location of that Dept (distinct), the third gives me (distinct) project from that location, then next is list box who displays the some codes of that project. The problem is I am able to select only one code from that list and get output in Excel.

    If I wanted to select two values at a time, how would I do that?

    If I select Multi Select from list box property than I am able to select multiple values but I am not getting output.

  • Justin
    Justin over 9 years
    Is it possible to have hidden columns - so using the hidden column to hold a "Code" and only showing the read friendly list?