Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do I use a macro to center a shape in a cell in excel
Just that! I have a macro that copies various data to create a formatted
sheet, and I want a shape to be centered vertically and horizontally within the cell after the cell is resized. Problem at present is that the shape retains its alignment with the top border of the cell when the cell is resized. I want to be able to center it. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do I use a macro to center a shape in a cell in excel
Got it!
Get the cell top and left properties; as well as the cell width and height and the object width and height, then do this: ActiveSheet.Shapes("Group 141").Select 'get the object With Selection .Left = Range("B23").Left + (Range("B23").Width - Selection.Width) / 2 .Top = Range("B23").Top + (Range("B23").Height - Selection.Height) / 2 End With "ElectroAeroguy" wrote: Just that! I have a macro that copies various data to create a formatted sheet, and I want a shape to be centered vertically and horizontally within the cell after the cell is resized. Problem at present is that the shape retains its alignment with the top border of the cell when the cell is resized. I want to be able to center it. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Center text in Excel 03 cell by using the keyboard? | Excel Discussion (Misc queries) | |||
Excel Shape Macro | Excel Discussion (Misc queries) | |||
Macro trust center problems in Excel 2007 | Setting up and Configuration of Excel | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming |