muilti-select listbox choices back into worksheet

Chris Davison

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,790
how do I get, say, 10 choices made on a multi-choice 4-column listbox from a userform back onto a worksheet - say cells A1:D10 ?

thanks
Chris
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Example:

Code:
Private Sub CommandButton1_Click()
    Dim i As Integer
    Dim r As Integer
    r = 0
    Worksheets("Sheet1").Cells(1, 1).Resize(65536, 4).ClearContents
    With ListBox1
        For i = 0 To .ListCount - 1
            If .Selected(i) Then
                r = r + 1
                Worksheets("Sheet1").Cells(r, 1).Value = .Column(0, i)
                Worksheets("Sheet1").Cells(r, 2).Value = .Column(1, i)
                Worksheets("Sheet1").Cells(r, 3).Value = .Column(2, i)
                Worksheets("Sheet1").Cells(r, 4).Value = .Column(3, i)
            End If
        Next i
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,227
Messages
6,164,717
Members
451,912
Latest member
HMF009

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