Shapes.AddLine (Excel)

As it applies to the Shapes object, returns a Shape object that represents the new line on a worksheet.

AddLine (BeginX, BeginY, EndX, EndY)


With Worksheets(1).Shapes.AddLine(10, 10, 250, 250).Line 
 .DashStyle = msoLineDashDotDot 
 .ForeColor.RGB = RGB(50, 0, 128) 
End With

Arguments

The following arguments are required:

BeginX (Single) - The position (in points) of the line's starting point relative to the upper-left corner of the document.

BeginY (Single) - The position (in points) of the line's starting point relative to the upper-left corner of the document.

EndX (Single) - The position (in points) of the line's end point relative to the upper-left corner of the document.

EndY (Single) - The position (in points) of the line's end point relative to the upper-left corner of the document.