Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Center text in Excel 03 cell by using the keyboard? tarebare Excel Discussion (Misc queries) 3 May 22nd 08 09:50 PM
Excel Shape Macro Lenny Excel Discussion (Misc queries) 0 May 19th 08 10:50 PM
Macro trust center problems in Excel 2007 David Walker Setting up and Configuration of Excel 1 January 9th 08 01:13 AM
Deleting a shape and the cell contents the shape is in. Dave Peterson[_3_] Excel Programming 1 October 9th 03 03:36 PM
Deleting a shape and the cell contents the shape is in. Tom Ogilvy Excel Programming 0 October 9th 03 03:43 AM


All times are GMT +1. The time now is 11:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"