"ComboBox1.ListIndex = 0" Doesn't seem to always work.

J

JudgeMental

Hi,

I have "ComboBox1" on a UserForm. In the Sub Form Initialize procedure, I
have "ComboBox1.ListIndex = 0" hoping to set the ComboBox to Index 0 every
time the Form is loaded. The problem is that maybe 50% of the time it loads
up with the last selection instead. Am I doing something wrong?

Thank you for your help!
 
J

JLGWhiz

If you are hiding your UserForm instead of unloading it, then the initialize
event won't fire when you show it again and your ComboBox will show the last
selected value. Since you didn't post all of your code, I can't tell you
much more.
 
J

Jon Peltier

If indeed the form was hidden, you could put the code into UserForm_Activate
to reset it when it is redisplayed.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top