Link to home
Start Free TrialLog in
Avatar of Saqib Husain
Saqib HusainFlag for Pakistan

asked on

Userform Listbox selection does not go away

I have attached this flashcard application which asks for two responses for each question (in listboxes) and moves on only when both answers are correct.

When both answers are correct the list is cleared and repopulated but the last selection does not go away.

Please help me get rid of the listbox selection once the lists are repopulated.
Listbox-problem.xls
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Either set both Listbox1.ListIndex and Listbox2.Listindex to -1 or unload and reload the userform
Avatar of Saqib Husain

ASKER

I had tried the -1 but to no avail.

How do I unload and reload the userform1?
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Saqib,

If i do this in your new word code..

ListBox2.ListIndex = -1

Open in new window


For me it don't select anything anymore in the listbox2..Now i'm not sure what you are trying to do here.. but it didnt had anything selected their..

Also i will change your newword which is called by userform activate to userform initialize.. so that it calls only when it loads otherwise dont call it everytime i select the userform or it becomes active..

Saurabh...
This worked. Thanks
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014