×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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

(OP)
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,

alan54
Replies continue below

Recommended for you

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
wid=selection.width
hei=selection.height
sf=1+textbox1.value/100' change to sf=range("sf").value or ?
selection.height=sf*hei
selection.width=sf*wid
exit sub
no_selection:
end sub

interesting, but ...

-pmover

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.

Regards,

Joerd

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



News


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