UserForm X

grumpyoldman

New Member
Joined
Dec 27, 2022
Messages
14
Office Version
  1. 2019
Platform
  1. Windows
I have a UserForm that calls another UserForm, when I press The X on the second UserForm it closes and goes Back to First UserForm then on the Second Visit The X no longer cancels the Second UserForm.
Could anyone Help Me Please.
the form closes using.....

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload Me
UserForm3.Hide
Teams.Show
End Sub

But this only works Once.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi
Try following & see if resolves your issue

1 - Delete this code in second userform

VBA Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload Me
UserForm3.Hide
Teams.Show
End Sub

2 - In your Teams Userform, Update the code that calls the second userform

Example
VBA Code:
Private Sub CommandButton1_Click()
    Me.Hide
    UserForm3.Show
    Me.Show
End Sub

As you are using the X close button to dismiss Userform3, this is the same as using the Unload method.

Hope Helpful

Dave
 
Upvote 1
Hi
Try following & see if resolves your issue

1 - Delete this code in second userform

VBA Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload Me
UserForm3.Hide
Teams.Show
End Sub

2 - In your Teams Userform, Update the code that calls the second userform

Example
VBA Code:
Private Sub CommandButton1_Click()
    Me.Hide
    UserForm3.Show
    Me.Show
End Sub

As you are using the X close button to dismiss Userform3, this is the same as using the Unload method.

Hope Helpful

Dave
Excellent Worked Perfectly Thank you so Much.!!!!!!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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