Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Automatic Scaling of EXCEL Drawings

Automatic Scaling of EXCEL Drawings

Automatic Scaling of EXCEL Drawings

I'm using EXCEL 2000.  Can you use the built in drawing feature and have objects scaled based on values in cells.

For instance, for a rectangle, you can right click / Format Autoshape / and change the height, width, etc under the Size tab.

But to set those equal to a cell value in VBA, I can't find the rectangle's object name (i.e. rectanglename.Width = value of cell)

Many Thanks,


RE: Automatic Scaling of EXCEL Drawings

response to first question - unfortunately not or not that i'm aware of.

2nd question:  try the selection.

with regards to a scaling factor, please note the code below used to change an object's size.  instead of the textbox1.value, change code for a cell input.  the code below is not in its entirity as i appreviated what the sub is actually used for.  be certain to have object selected.

Private sub CommandButton2_Click()
on error goto no_selection
sf=1+textbox1.value/100' change to sf=range("sf").value or ?
exit sub
end sub

interesting, but ...


RE: Automatic Scaling of EXCEL Drawings

You can refer to any shape on a worksheet by its name, through the Shapes collection.

ActiveSheet.Shapes("Rectangle 1").Height

You can read/write all relevant properties in this manner, so in your case ActiveSheet.Shapes("Rectangle 1").width = Activesheet.Range("A1").Value

The width/height etc. are specified in points = 1/72 inch.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close