ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   can excel draw a shape based on values entered in cells (https://www.excelbanter.com/excel-worksheet-functions/20582-can-excel-draw-shape-based-values-entered-cells.html)

Milo

can excel draw a shape based on values entered in cells
 
I want to draw a rectangle which is sized by measurements entered on a
different sheet

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



All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com