Name
series
.Trendlines([Index
])
Synopsis
Returns one or all of the Trendline
objects for a series. Use the Trendlines
collection to add trendlines to a series as shown by the following code:
Sub AddTrendline( ) Dim chrt As Chart, sr As Series, tl As Trendline ' Get a chart. Set chrt = ActiveChart ' Get first series Set sr = chrt.SeriesCollection(1) ' Add a trendline Set tl = sr.Trendlines.Add tl.Type = xlMovingAvg End Sub
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.