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