I have the following code:
I would like the Macro to work with selected chart instead of ChartObjects(1). I have many charts in the spreadsheet. Many thanks.Code:Sub GetTLineEq()
Dim chrtobj As ChartObject
Dim chrt As Chart
Dim srs As Series
Dim tline As trendline
Dim dlbl As DataLabel
Dim str As String
With ActiveSheet
Set chrtobj = ActiveSheet.ChartObjects(1)
Set chrt = chrtobj.Chart
Set srs = chrt.SeriesCollection(1)
Set tline = srs.Trendlines(1)
Set dlbl = tline.DataLabel
str = dlbl.Text
.Range(Selection.Address).Value = str
End With
End Sub
