View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Unloading all open and hidden UserForms

You will have to decide which method you want to use to execute the code.
i.e. UserForm_Click event, CommandButton_Click event, etc. but the code
will need to be where it can be initialized while a form is showing,
assuming you are showing them modal.
If you show them modeless, you could use a single command button on a sheet.
If they are modal and you use the form click event, then you would need the
code in each form code module. You can probably figure out the rest.

Private Sub 'your choice of method
For i = UserForms.Count - 1 To 0 Step -1
Unload UserForms(i)
Next
End Sub


"Ayo" wrote in message
...

I am trying to figure out how to unload all hidden UserForms. I have about
7 UserForms but I use Me.Hide for all of them. At any point when I click
the
cancel button on any of the UserForm I want all the open forms that are
hidden to be unloaded.
How do I go about doing this.