userform listbox selection

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Userform listbox selection

Userform listbox selection

resolvedResolved · Urgent Priority · Version 2007

Karen has attended:
Excel VBA Advanced course

Userform listbox selection

Hi,
I wondered if you could help with this VBA question.

I have created a uerform with a listbox and I can populate it with a list. I want users to make mulitple selections from the list and it highlight which selections have been made before someone clicks 'OK' and a cell is populated with the selections.

Also, when a selection is revisited (by clicking in the cell that was populated) the previous selections are highlighted in the userform so someone can deselect and then click 'OK' to update the cell.

Any ideas would be appreciated.
Thanks
Karen

RE: Userform listbox selection

Hi Karen

Thanks for getting in touch. Working with the ListBox in VBA forms is unfortunately a cumbersome process.

To read the items, you have to loop through the .Selected property of each ListItem and record their status. This will probably be an array inside a FOR NEXT / FOR EACH loop.

Whilst you are doing this you can then record these states so that you may reinitialise the ListBox with the array values.

I hope this helps, give it a try and let us know if you require further advice.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Fri 23 Nov 2012: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Pivot table grouping

If you want to group items in a pivot table together, simply highlight the labels for the fields either with the shift key (if adjacent)or with the contral key if they are not next to each other.
Right click and choose group. Give the cell a name.

When you double click on this cell it will either expamd or collapse your grouped area

View all Excel hints and tips


Server loaded in 0.08 secs.