ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving Shapes within VBA (https://www.excelbanter.com/excel-programming/395909-moving-shapes-within-vba.html)

Juan Schwartz

Moving Shapes within VBA
 
I know you can nudge shapes X pixels or what have you, but is there a
way to set the image to a home position... IE position it in the top
left corner so I can know how far to move it OR position the image
relative to other images already in place?

Thank you,

Jimmy


joel

Moving Shapes within VBA
 
Picture names are had to get. but this code works when there is only one
picture on a worksheet

Sub moveshape()

For Each myshape In ActiveSheet.Shapes
myleft = myshape.Left
myRight = myshape.Top
msgbox("Picture Name = " & myshape.name)
myshape.Left = myleft + 10
myshape.Top = mytop + 10
Next myshape
End Sub

Method 2

Sub moveshape1()
With ActiveSheet.Shapes("Picture 1")
myleft = .Left
myRight = .Top

.Left = myleft + 10
.Top = mytop + 10
End With
End Sub



"Juan Schwartz" wrote:

I know you can nudge shapes X pixels or what have you, but is there a
way to set the image to a home position... IE position it in the top
left corner so I can know how far to move it OR position the image
relative to other images already in place?

Thank you,

Jimmy



Juan Schwartz

Moving Shapes within VBA
 
On Aug 20, 11:02 am, Juan Schwartz wrote:
I know you can nudge shapes X pixels or what have you, but is there a
way to set the image to a home position... IE position it in the top
left corner so I can know how far to move it OR position the image
relative to other images already in place?

Thank you,

Jimmy


Anybody?


joel

Moving Shapes within VBA
 
You can use the 1st program to get all the picture names, then use the 2nd to
move the pictures. You just have to figure out which name goes with which
picture.
You can put the locations in a message box, then the picture with the
smallest top dimension and smallest left dimension is the one on the top left
of the worksheet. Then continue doing this for each picture.

"Juan Schwartz" wrote:

On Aug 20, 11:02 am, Juan Schwartz wrote:
I know you can nudge shapes X pixels or what have you, but is there a
way to set the image to a home position... IE position it in the top
left corner so I can know how far to move it OR position the image
relative to other images already in place?

Thank you,

Jimmy


Anybody?




All times are GMT +1. The time now is 05:37 PM.

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