list box help

Aprez76

New Member
Joined
Aug 7, 2008
Messages
23
Looking for some help extracting info from a list box into a worksheet.

Right now I have a user form that has a list box set to multi select with check box style. I would like to extract the record(s) selected by the user to a worksheet... say sheet1, cell a1. Can't figure how to do this with the multiselect.

Any help is much appreciated.

Thanks,

Andrew
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try something like this:

Code:
    Dim i As Long
    With Me.ListBox1
        For i = 0 To .ListCount - 1
            If .Selected(i) = True Then
                ActiveSheet.Range("A1").Offset(i, 0).Value = .List(i)
            End If
        Next i
    End With

What you're basically doing is looping through the listbox items and, if they are selected, writing them out to the worksheet.

Modify the listbox name, worksheet, and range as needed.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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