Shape.Top/Left changing despite point remaining stationary

icewing726

New Member
Joined
Oct 9, 2014
Messages
14
My Objective: I have a plot plan that I've figured out a scale between points and feet on. However, to make it more interactive I want it to store the positions as they are labeled so they can autopopulate as people reuse them. I realize that's vague but suffice it to say I'm real close to there.

My Issue: Autopopulate was working but in some cases it doesn't. I created some test code and found out the issue. First, I'm using an elbow connector as the shape I'm manipulating for this. When the top left stay stationary and I drag the other end down and to the right the top left position changes.

However, if you drag the object so the rotation of the object is 0 or 180, the top and left values stay stationary (which is desired/expected). 90 and 270 result in both values changing and I can't figure out they rhyme/reason behind it.

I've tried holding the top left stationary, I've tried holding the bottom right stationary. The only predictable adjustment is 0 or 180. Hoping someone can help me understand.

Here's a code snippet to give you readouts. Simply insert an elbow connector and name it "Measurement"

Thanks for your help!

Code:
Sub Measure()
Set sp = ActiveSheet.Shapes("Measurement")
MsgBox (sp.Left & "//" & sp.Top)
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
The core of your problem is that Excel rotates shapes around the center of the shape, not the TopLeft corner.\
You could have a routine that will snap the shape to a pre-determined location.
 
Last edited:
Upvote 0
The core of your problem is that Excel rotates shapes around the center of the shape, not the TopLeft corner.\
You could have a routine that will snap the shape to a pre-determined location.
Thanks for the reply.

So, I mentioned rotation because as you drag one end of the elbow connector it changes the shape to reach end to end. The one end does remain stationary (the end you aren't moving).

The reason I mentioned the rotation is because when you pull the end far to the right it ends up with a 0 or 180 rotation on the shape. When it has this rotation the top and left change predictably. If you pull down and to the right with that rotation being automatically applied it doesn't change as expected. If you pull up and to the right with that rotation only the top changes as expected.

However, if you pull further up or down so that the height difference is greater it'll auto rotate to 90 or 270 while you pull. When it's in this rotation both top and left values constantly changes when you resize either point.

There is no way to lock rotation either, at least not that I've found.

Second, I forgot to mention I am super zoomed out on this. Doing this on normal zoom may result in much smaller variances.
 
Upvote 0
Here's some screen shots to show the issue. The read out is top then left. (Note: Locking the rotation of the image would probably work too but its not an option that I've found)
(Rotation 180, Screen Shot 1)
tinypic.com
[/URL][/IMG]
(Rotation 180, Screen Shot 2)
tinypic.com
[/URL][/IMG]
(Rotation 270, Screen Shot 1)
tinypic.com
[/URL][/IMG]
(Rotation 270, Screen Shot 2)
tinypic.com
[/URL][/IMG]
 
Upvote 0
I figured it out guys.

So in orientation 0 or 180 the Shape.top and Shape.Left give accurate consistent measurements.

In the 90 or 270 the top and left have to be adjusted to give accurate consistent measurements.

The code is Shape.Top-((Shape.Width-Shape.Height)/2) and Shape.Left+((Shape.Width-Shape.Height)/2)
(NOTE: THIS ADJUSTMENT ONLY APPLIES WHEN OBJECT IS ROTATED 90 or 270//Shape.Rotation)

Also, the shape used here is an elbow connector
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,022
Latest member
RobertV1609

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