PDA

View Full Version : Solved: Force shape to be inserted in middle of cell



hunsnowboard
02-07-2009, 03:48 PM
Hi Everyone! I have a macro which based upon a value should return a shape. I have the shapes on a separate (hidden) worksheet. As I have never worked with shapes, I tried to record a macro which copies the shape to the sheet and cell I need, and I moved the shape in the middle of the cell. The problem is that each time I run the macro, the shape is pasted on a different location (close to the location I need). How can I force the shape to be in the middle of the cell "H5"? Thank you in advance for your help!

Bob Phillips
02-07-2009, 04:18 PM
With ActiveSheet.Shapes("myShape")

.Top = Range("H5").Top + Range("H5").Height / 2 - .Height / 2
.Left = Range("H5").Left + Range("H5").Width / 2 - .Width / 2
End With

hunsnowboard
02-08-2009, 02:58 AM
Thank you Xld! It is working!