ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for moving arrow shapes (https://www.excelbanter.com/excel-programming/428727-macro-moving-arrow-shapes.html)

Yajiv

Macro for moving arrow shapes
 
I have an arrow shape pointing upwards. I want to move it's head with
the other end fixed. Just like a speedometer.If I use shapes
(0).rotation(45), i get the rotation, but it adjusts the whole arrow.
not the head.
Is there any way? Any help would be appreciated.

joel

Macro for moving arrow shapes
 
You need two lines. One always fixed that is verticle and one that rotates
with the arrow.

"Yajiv" wrote:

I have an arrow shape pointing upwards. I want to move it's head with
the other end fixed. Just like a speedometer.If I use shapes
(0).rotation(45), i get the rotation, but it adjusts the whole arrow.
not the head.
Is there any way? Any help would be appreciated.


Patrick Molloy

Macro for moving arrow shapes
 
tricky this
rotation moves the entire arrow. so we calculate how far the bottom moved,
and move it back.

so we know where the bottom of the arrow is (x1,y1) which is the TOP +
HEIGHT if the arrow srarts veritcally
when we rotate we know the new position, so we can calculate the new bottom
position (x2,y2)
we need to move the TOP (X2 - X1, Y2-Y1) which will shift the shape so that
the bottom part of the arrow returns to its original position

"Yajiv" wrote in message
...
I have an arrow shape pointing upwards. I want to move it's head with
the other end fixed. Just like a speedometer.If I use shapes
(0).rotation(45), i get the rotation, but it adjusts the whole arrow.
not the head.
Is there any way? Any help would be appreciated.



Andy Pope

Macro for moving arrow shapes
 
Hi,

Group your arrow with a rectangle. The rectangle should be twice the height
of the arrow. Then make the width the same as the height.
Now select both rectangle and arrow. Align Top and Centers. Format rectangle
to have no fill or border. Group the 2 shapes.

Now when you rotate the grouped shape it will rotate around the center,
which is where the base of the arrow sits.

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Yajiv" wrote in message
...
I have an arrow shape pointing upwards. I want to move it's head with
the other end fixed. Just like a speedometer.If I use shapes
(0).rotation(45), i get the rotation, but it adjusts the whole arrow.
not the head.
Is there any way? Any help would be appreciated.




All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com