Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-07
3
Medium Priority
?
1,667 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

972 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