Forum Discussion

grandajj's avatar
grandajj
Copper Contributor
Apr 03, 2021

Line drawing data into cells in Excel

Does anyone know how to automatically save the height and width of lines drawn in excel?  If you draw a line Excel displays the height and width?.  I would like to save those values do do calculations.

1 Reply

  • grandajj 

    You need VBA to handle shapes.

    Dim shp As Shape
    Set shp = Sheet1.Shapes("Straight Connector 1")
    a = shp.Height
    b = shp.Width
    length = (a * a + b * b) ^ 0.5

Resources