Public Sub Trendline_Start_End_Points()
Dim ch As Chart
Dim ser As Series
Dim xVals As Variant
Dim trLine As Trendline
Dim p1 As Long, p2 As Long
Dim m As Double, b As Double
Set ch = ActiveSheet.ChartObjects(1).Chart
Set ser = ch.SeriesCollection(1)
xVals = ser.XValues
'Extract m and b values from linear trendline equation, y = mx + b
For Each trLine In ser.Trendlines
If trLine.DisplayEquation Then
With trLine.DataLabel
p2 = InStr(.Text, "x")
b = Trim(Mid(.Text, p2 + 1))
p1 = InStrRev(.Text, "=", p2)
m = Trim(Mid(.Text, p1 + 1, p2 - p1 - 1))
End With
End If
Next
MsgBox "Trendline start point: x=" & xVals(1) & " y=" & m * xVals(1) + b & vbCrLf & _
"Trendline end point: x=" & xVals(UBound(xVals)) & " y=" & m * xVals(UBound(xVals)) + b
End Sub