How to close userform if another is open

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi please could you help me
I have 2 userform called userform 1 and userform 2. If someone has userform 1 already open and someone else trys to open userform 2 I want it to automatically close userform 2 with a message to try later. Can you help me please?
 
Put that code in every userform that you don't want to open whenever another is already open.

Or rather, add that code to the userforms' existing Intialize event (if any)
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi just wondering if i have done this correctyly, I have inserted a module and copied the code into this module. is that correct? do I need to do anything else? or update any code anywhere else? I am new to modules. thanks for your help
 
Upvote 0
I note you said:
If someone has userform 1 already open and someone else trys to open userform 2 I want it to automatically close userform 2

If you are talking about two different users on two different machines, then I think you are out of luck.
 
Upvote 0
There is no link between the two instances, so I fear you are out of luck. Why does it matter?
 
Last edited:
Upvote 0
ok thanks, I have it as shared for 2 users, what happens is there is 2 userforms and when they click submit when all data has been entered, the data gets moved into sheet1, but I was thinking if they updated the sheet at the same time it wont work properly, so I thought that if a user was in one userform then the other user wont be able to get in the other until the update has been done
 
Upvote 0
If you have a Shared Workbook as a database, I'd say you are in for a world of pain. You'd be much better off using a proper database app or, if you don't have one, at least use a separate workbook for the data store.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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