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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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