I am using "UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)" to close a userform because I need to trigger the exact same action whether some one clicks on the Cancel button I've created, or the little red X.
If someone clicks on the EmpStatusDone button, then the macro "Rearrange" is run. The first thing this macro does is switch to a different sheet. At this point I need to have the userform close, because the macro will launch a new userform, and I don't want to have both on the screen at the same time. Do I need to put things in a different order (not that there's a lot of choice here), or is there something I can add to the "Rearrange" macro?
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = False
If Range("C2") = "Endrun" Then
Application.Run "Rearrange"
Else:
Application.Run "StatusCancel"
End If
End Sub
Private Sub EmpStatusCancel_Click()
Unload Me
End Sub
Private Sub EmpStatusDone_Click()
Range("C2") = "Endrun"
Unload Me
End Sub