Listbox Multiselect - Help with Output

Ryan Fisher

New Member
Joined
Oct 22, 2010
Messages
4
I have a listbox set up with multiselect that is populated with information from cells A2:A10. If a user selects more than one item, I want each item to show up in a different cell. For example if they select items 1,4, and 6, then I would like item 1 to show up in cell B2, item 2 to show up in cell B3, and item 3 to show up in cell B4.

Thanks for the help!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
How about using a command button to execute the code? Once the items have been selected from the listbox, the command button can be clicked, and the selected items will be copied to Column B, starting at B1, of the acitve sheet. If so, create a command button, and place the following code in the module for the userform...

Code:
Private Sub CommandButton1_Click()
    Dim r As Long
    Dim i As Long
    With Me.ListBox1
        r = 1
        For i = 0 To .ListCount - 1
            If .Selected(i) Then
                Cells(r, "B").Value = .List(i)
                r = r + 1
            End If
        Next i
    End With
End Sub

Change the name of the command button, accordingly.
 
Upvote 0
Thanks Domenic!

That is exactly what I needed! I'm putting together a dashboard for a financial institution and this is the missing piece.
 
Upvote 0
Hi Domenic,

I tired using this setup and code for a similar situation, but only the first item selected from the multi-select box is returned to the first cell in the output range. What am I doing wrong?

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top