Multiselect listbox cell link

Nuz

Board Regular
Joined
Aug 16, 2010
Messages
88
I have a listbox on the worksheet where multiple items can be selected. Listbox is created from Forms toolbox (i.e. not from Control Toolbox).

Ho can I determine what are the selected items on the list? I have set a Cell link but it always displays 0. If selection type is 'Single' then it works but I have to use the selection type 'Multiple'.
 
VBA Code:
    With ActiveSheet.Shapes(Application.Caller)
        Set LinkedCell = Range(.ControlFormat.LinkedCell)
        With .OLEFormat.Object
            For i = 1 To .ListCount
                LinkedCell.Offset[B](i-1, 0)[/B] = .Selected(i)
            Next i



Wow, thanks mikerickson, I decided to poke at it a little and was able to remove the "0" output from the cell link by subtracting 1 from the I, thanks for the prompt reply.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I would hesitate to make that change. Changing the value of the linked cell also changes the state of the control. That might not be the case in a multi-select List Box, but I'd need to test before trusting.
Note also that if you have many list boxes, you can assign the same macro (with no change) to each list box and they will all behave appropriatly.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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