If userform is already open then MSG box to open saying Userform in Use


Well-known Member
Hi I am trying to put a code together into a command button which opens the userform1, but if someone else has the userform open already I want a msgbox pop up to say that ‘userform is in use’, I have put the following code togetherbut getting no joy. Hope you can help?

Private Sub CommandButton1_Click()
If CurrentProject.AllForms("UserForm1").IsLoaded = False Then
     ' Form is closed
     MsgBox "userform is in use"
     ' Form is open
End If

End Sub
Last edited:


MrExcel MVP, Moderator
What do you mean by "if someone else has the userform open already"? Userform instances are specific to the excel application instance, so someone else can't have the same userform open.


MrExcel MVP, Moderator
Not directly. You'd need to log the fact the userform is open in say a text file in a location accessible to both users (eg a network folder) and then check for that file in the form's Initialize event.


Well-known Member
wow that sounds tricky, is there a way to share the workbook (userform) so all users can update at the same time?

Some videos you may like

This Week's Hot Topics