ListBox Help

rockchalk33

Board Regular
Joined
Jan 12, 2016
Messages
111
Hey all,

I have a ListBox with a variable list and the MultiSelect property turned on. I need to the below code to operate through each selected value in the ListBox instead of the current range as defined by o.

Code:
Dim N As Range, o As Range
Set o = Sheets("Sheet3").Range("A2:A3000")

For Each N In o

....

Next N

I cannot change these variable names due to the sheer size of the program (no ctrl+h is not currently an option)...Below is what I'm ultimately trying to achieve:


Code:
Dim N As 'each selected value in' Range
Dim o As Range
Set o = ListBox3.ListCount

For Each N In o

....

Next N

Thanks for help!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Use the selected property and the index is N:

Code:
For N = 0 to ListBox3.ListCount - 1
    YourData = ListBox3.Selected(N)
Next
 
Upvote 0

Forum statistics

Threads
1,215,486
Messages
6,125,070
Members
449,205
Latest member
Healthydogs

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