Center Userform

Molden

Active Member
Joined
Jun 20, 2006
Messages
373
Hi,

I have some code that extends my userform depending on what is selected on a drop down box. But when I shrink the userform it is no longer in the center of the screen.

Does anyone no how to center a userform via code.

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

In the properties box, under the position title, check the "center screen" option - see if that works. You can also try

Code:
UserForm2.StartUpPosition = 2
 
Upvote 0
As a user I would find it very disconcerting if a UserForm moved on the screen when it was resized. In my view you should stick with the initial left and top positions, allowing for any increases in size.
 
Upvote 0
it just looks a bit weird - one minute its in the center and next its more to the left.

Thanks for the advise though I will try the above code first.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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