UserForm_Initialize

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I've got my UserForm_Initialize event to empty all the
form fields, but sometimes values appear when the form is
loaded. Am I using the wrong event?
 
Rob,

The Initialize event is executed when the form is loaded in to
memory, not when it is displayed. Therefore, if you load (or
show for the first time) the form, Initialize will run. If you
then Hide the form and Show it again without Unloading the form,
Initialize will not run. If you need to run Initialize every time
the form is shown, you should Unload the form after hiding it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Rob,

have you checked what's happening in the UserForm_Activate event? Bringing up
the form using UserForm.Show triggers both
the Initialize and Activate events.

-- Dennis Eisen
 
Back
Top