Solved

Excel VBA - move a shape within a cell to the bottom right position of the cell

Posted on 2008-10-07
3
1,414 Views
Last Modified: 2012-06-21
If I have a Shape object (e.g. looping through For Each s In Application.ActiveSheet.Shapes) which is located entirely within a single cell.

How can I determine where to move the shape so it is in the bottom right of that cell?
0
Comment
Question by:jnash67
  • 2
3 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 22661364
Shape.Top = Shape.TopLeftCell.Top + Shape.TopLeftCell.Height - Shape.Parent.Height
   Shape.Left = Shape.TopLeftCell.Left + Shape.TopLeftCell.Width - Shape.Parent.Width

Kevin
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 22661408
Correction:

    Shape.Top = Shape.TopLeftCell.Top + Shape.TopLeftCell.Height - Shape.Height
    Shape.Left = Shape.TopLeftCell.Left + Shape.TopLeftCell.Width - Shape.Width

Kevin
0
 

Author Closing Comment

by:jnash67
ID: 31503921
This was perfect. Thx.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question