close all open userforms

ladbroke

Board Regular
Joined
Jun 2, 2006
Messages
175
Office Version
  1. 365
Platform
  1. Windows
Is there a code i can attach to a commandbutton that once clicked will close all current open userforms...

I may have more than one, and not any specific one, open at anytime and would want them to close when pressed.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I didn't know the difference....
Just apply whatever the command is to close...

form.close or
form.unload
 
Upvote 0
Slightly off track, what is the difference between hiding and closing? I've always used .Hide and never had any trouble.
 
Upvote 0
Is there a code...

Ive re-tried the original one and it doesn't really do what i want it to do.

I really would like to be able to close all open userforms..

I will tend to have just 2 userforms open at 1 time. When a commandbutton is clicked, i would really like to close the 2 open forms and then open the form of the button clicked.

can someone please post a code that will work?
 
Upvote 0
for some reason it keeps coming up that i need to debug the Unload Userforms(i) line...

Why isn't this working?
 
Upvote 0

Forum statistics

Threads
1,223,922
Messages
6,175,382
Members
452,639
Latest member
RMH2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top