Moving Shapes within VBA

J

Juan Schwartz

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
 
G

Guest

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
 
J

Juan Schwartz

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?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top