You gave us no specifics, so I used made up data that you will have to adjust to match your actual setup...I am trying to center an image in a cell. the cell is quite large as is the image. Can anyone assist me with this?
Sub CenterPicture()
Dim Cell As Range, Image As Shape
Set Cell = Range("G9")
With Sheets("Sheet1").Shapes("Picture 1")
.Top = Cell.Top + (Cell.Height - .Height) / 2
.Left = Cell.Left + (Cell.Width - .Width) / 2
End With
End Sub
I did say "you gave us no specifics" which meant I had to guess at a couple of things... my expectation was that you would change those guesses to meet your actual setup (if you are not going to give specific information about your setup and needs, you will have to learn how to spot the things that will need changing). Here is the code I posted, modified slightly (I moved one line of code)...Rick,
When I tried your code I got an error message stating "Subscript out of range."
Sub CenterPicture()
Dim Cell As Range, Image As Shape
With Sheets("[COLOR="#008000"][B]Sheet1[/B][/COLOR]").Shapes("[B][COLOR="#FF0000"]Picture 1[/COLOR][/B]")
Set Cell = .Range("[COLOR="#0000FF"][B]G9[/B][/COLOR]")
.Top = Cell.Top + (Cell.Height - .Height) / 2
.Left = Cell.Left + (Cell.Width - .Width) / 2
End With
End Sub