Bring open userform to front

miami2k

Board Regular
Joined
Nov 1, 2017
Messages
58
Dear All,

I have an issue with my project. When I work with more than one Excel file at the same time, it happens sometimes that the main userform is open in front of an Excel file that is not the one on which it is based.
I added this code under the sub of first combobox change:
VBA Code:
Set SCFI = ThisWorkbook
SCFI.Activate
This brings the right Excel file in front but unfortunately the userform goes behind.
I cannot use the command myuserform Show because it goes in a sort of loop.
I've read something about a function (API Code?) but I was looking for something simpler.
Any suggestion?
Thank you

miami2k
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If you are using a User Form then you can just use the below code when calling the User Form to open and it stays open on top of all Excel Files that you open

VBA Code:
    UserForm1.Show (vbModeless) ' Change UserForm1 to whatever your User Form is
 
Upvote 0

Forum statistics

Threads
1,214,984
Messages
6,122,601
Members
449,089
Latest member
Motoracer88

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