Edit

Share via


Trendline object (Excel Graph)

Represents a trendline in the specified chart. A trendline shows the trend, or direction, of data in a series. The Trendline object is a member of the Trendlines collection, which contains all the Trendline objects for a single series.

Remarks

Use Trendlines (index), where index is the trendline's index number, to return a single Trendline object.

The index number denotes the order in which the trendlines are added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.

Example

The following example changes the trendline type for series one in the chart. If the series has no trendline, this example fails.

myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.