New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

autoshape resized based on data fields

Macros, VBA, Excel Automation, etc.

autoshape resized based on data fields

Postby kmorlatt » Fri Jan 06, 2012 11:17 pm

Hi! I did ask this question at below and rec'd very good solution(s) that I tried however still not working for me.
Question: After inserting a round autoshape into excel...would like it to grow/shrink based on a number in a 'related' data field...for instance if I change the number in a field from 100 to 50 the round autoshape shrinks and visa versa...something like the pubil of an eye.
http://www.eggheadcafe.com/community/excel/66/10405424/autoshapesdata-fields.aspx
Thank you very much!
  • 0

kmorlatt
Rookie
 
Posts: 1
Joined: Jan 6, 2012
Reputation: 0

Re: autoshape resized based on data fields

Postby Sisyphus » Sat Jan 07, 2012 8:14 am

Hi,
I tried my hand at this and attach the result. This is how I approached the problem:
Excel places the Autoshape relative to a fixed Top, defining its upmost limit, and a fixed Left which defines its leftmost extension. As the shape - in this case a circle - grows or shrinks its center moves. I thought that you would want the center to remain in place. Therefore the Top and Left had to be adjusted in accordance with the diameter of the circle.
Increase or decrease is defined as a percentage. 100% is the original size, 0% shrinks the circle to a dot, and any other percentage is relative to the original size. You can adjust this original size to any value you want, so long as its diameter is smaller than the fixed Left. When you deploy the system you may not want to define the original size on the worksheet. Well, that will save the code of reading the worksheet. Same for the Left and Top properties which I set arbitrarily, much like the diameter. You can adjust them to anything you want and keep the original values anywhere you want, but you need these three "original" parameters. On the attached sheet I have placed the 100%-sized circle in a frame. This is just to show that the center doesn't move.
I hope, this is what you wanted. :D
  • 0

You do not have the required permissions to view the files attached to this post.
Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: Google [Bot] and 271 guests