ListBox to remember selected ITEMS, multiselect

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance!

I have a ListBox coming rom the ActiveX controls on a Sheet.

this ListBox is multiselect, so imagine I have 25 items on this listBox and I have selected 4 of them in a random order (just for this eg)

The selected items are the: 2nd, 5th, 11th and 21st

so this items are blue colored.


When I save the WorkBook, and the next day I Open the same WorkBook

What do I have to do to remenber that 4 items where selected (the 2,5,11,21)

At present my ListBox, comes with no selections, no blue colored items on it.


DO I have to use any other Control,


A CheckBox remembers if it has been selected, "but I cannot" use CheckBoxes, because my ListBox has dinamic items.


Thanks!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Then, you will need VBA code to keep track of your choices. For instance, the (standard) ActiveX listbox has an event:

Private Sub ListBox1_Click()

then on a (hidden) sheet you could list those items selected.

To "read" the selections back in, similar code could be used (but the other way round of course): you set the Selected property based on the contents of the (hidden) sheet.

I'm sure there will have been many topics with code on the forum, if you use the Search function.
 
Upvote 0
What you say is actually my actual choice.

But since I have to feed and keep track of many different ListBoxes, probably there is any other method.

And if there is any, I would like to know it.


PS: if there is no any alternative, then I would like to know it as well, to close my query!

Thanks!
 
Upvote 0
No, there's no workaround. But in that helper sheet, even if you have a lot of listboxes, you can get away with 1 column per listbox.

Code it in a general way (not hardcoded) and then I think it will be not too bad as a solution.
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,544
Members
452,925
Latest member
duyvmex

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