# Coordinates of two endpoints of a line segment

#### northwolves

##### Well-known Member
Any one knows how to use VBA to get the coordinates of two endpoints of a line segment in a worksheet? Million thanks.

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Any one knows how to use VBA to get the coordinates of two endpoints of a line segment in a worksheet?
When you say "line segment", do you mean a Line Shape?

How did you want an end point returned to you... as a single text string like (12,34) or as two separate numbers in two separate cells?

Code:
``````Set myDocument = Worksheets(1)
.DashStyle = msoLineDashDotDot
.ForeColor.RGB = RGB(50, 0, 128)
End With``````

Then we get a shape line. when we save and reopen the document, how can we get the coordinates of two endpoints(10,10),(250,250) by codes?

Replies
1
Views
84
Replies
1
Views
99
Replies
1
Views
515
Replies
3
Views
278
Replies
0
Views
322

1,203,052
Messages
6,053,237
Members
444,648
Latest member
sinkuan85

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back