Userform Show Modal

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,074
Office Version
  1. 2019
Platform
  1. Windows
I have two userform (Userform A - ShowModal=True & Userform B - ShowModal=False). When I minimize A, B appears. When I close B, A also closes. I want A to remain showing. How can i make B remain open when I close A. (Confused...my apologies)
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I'm not sure how you Minimize a UserForm

Please show us the code your using to close Your UserForm.

And show me the code your using to Minimize your UserForm.

And just curious why you need 2 UserForms Open at the same time.

I have used UserForms for years and never needed 2 open at the same time.
 
Upvote 0
Try ...

On worksheet - opens userform1 modeless
Code:
Private Sub CommandButton1_Click()
    UserForm1.Show vbModeless
End Sub

In userform1 - hides userform1 and opens userform2 modal
Code:
Private Sub CommandButton1_Click()
    UserForm1.Hide
    UserForm2.Show vbModal
End Sub

In userform2 - shows userform2 (with values all retained) when userform2 is closed (using X in top-right-corner)
Code:
Private Sub UserForm_Terminate()
    UserForm1.Show
End Sub
 
Last edited:
Upvote 0
ooooops! you probably already spotted the inconsistency in previous post - it won't work after the first hop between the forms :oops:

userform2 code should be
Code:
Private Sub UserForm_Terminate()
       UserForm1.Show vbModeless
End Sub
 
Last edited:
Upvote 0
I suspect my earlier suggestion may not deliver what you want

Excel is a bit "picky" when trying to keep more than 1 userform open at the same time. But there is a number of different ways to give the user what is required and allow values to be retained etc. But we need to understand what your overall needs are.

If above solution is not helpful ...

Post current code (as requested by @My Aswer Is This)

What is the purpose of both forms ?
Why do they need to be 2 separate forms ?
What (else) you need user to be allowed to do when userform1 is open and (separately) when userform2 is open ?
Why does userform1 need to be kept open when userform2 is shown ?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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