Dimensions of Shapes

Solved
Hello everyone, Forum hello,
<config>Windows 10 / Edge 81.0.416.68</Excel 2007>

I have inserted several shapes on my sheet 1, including a square and 5 rectangular shapes of different sizes.

I would like to know please where to find or how to calculate the dimensions of each shape.

Example: Rectangle 1 = ???

Top =
Left =
Width =
Height =

Thank you all for your help, have a good end of the afternoon.

Best regards, Dudu

4 answers

  • Votes
  • Date
  • Descending date
  1. Hello,

    Simply put:
    Sub test() Dim shp As Shape For Each shp In Worksheets("Sheet1").Shapes Debug.Print shp.Name, "T:" & shp.Top, "L:" & shp.Left, "W:" & shp.Width, "H:" & shp.Height Next shp End Sub


    Best regards
    Patrice

    No one can possess all knowledge, that's why we share it.
    1. Hi Patrice 33740,

      Thank you for your reply and the little code.

      I have the code in a module, then on my Sheet1 I selected a shape and ran the macro

      but no result is displayed on the screen, could you please show the result in a MSGBOX with the name of the selected shape and of course the dimensions.

      For your information, each shape has a different name

      Thank you for your help, it's nice of you.

      Best regards, Dudu
    2. Hi Le pivert, Patrice,

      Thank you for your remark, you are right, I apologize, I completely forgot the code you made for me.

      I haven't found it yet, but this time it's organized.

      Thanks again to both of you, and I'm sorry.

      Have a good evening and thanks again.

      I will therefore close the subject.

      Best regards, Dudu