Align Object to center of screen

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello all.

I am animating a logo in my sheet, but I am having a hard time centering the object in the middle of the users screen. my only directional options seem to be
Code:
    Sheet1.Shapes("Logo").Left = 20
    Sheet1.Shapes("Logo").Top = 0

Is there a way to have it centered in the middle of the screen - whatever size that maybe?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I have different workbooks where my userforms change size depending on selections made, so to make sure they stay centered I use:

Code:
Me.Left = (Application.Width / 2) - (Me.Width / 2)
Me.Top = (Application.Height / 2) - (Me.Height / 2)

Just adapt that for your shape, and it should work.
 
Upvote 0
Untested, but try

Code:
Sheet1.Shapes("Logo").Left = 0
Sheet1.Shapes("Logo").Top = Application.Height - Sheet1.Shapes("Logo").Height

Edit: I was assuming you were talking about the bottom left corner. If you were talking about the bottom right corner, it might be:

Code:
sheet1.Shapes("Logo").Left = Application.Width - Sheet1.Shapes("Logo").Width
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,398
Members
449,222
Latest member
taner zz

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