can excel draw a shape based on values entered in cells

G

Guest

I want to draw a rectangle which is sized by measurements entered on a
different sheet
 
F

Fred

Assuming you have a rectangle named "Rectangle 1" on worksheet 1, and
your size data is contained on worksheet 2, you could enter the
following code which would size the shape object upon clicking a
command button.

Private Sub cmdProcess_Click()

ActiveSheet.Shapes("rectangle 1").Width =
Worksheets("Sheet2").Range("a1")
ActiveSheet.Shapes("rectangle 1").Height =
Worksheets("Sheet2").Range("b1")

ActiveSheet.Shapes("rectangle 1").Left =
Worksheets("Sheet2").Range("c1")
ActiveSheet.Shapes("rectangle 1").Top =
Worksheets("Sheet2").Range("d1")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top