Name
trendlines
.Add([Type
], [Order
], [Period
], [Forward
], [Backward
], [Intercept
], [DisplayEquation
], [DisplayRSquared
], [Name
])
Synopsis
Adds a trendline to a series.
Argument |
Settings |
---|---|
|
An |
|
For polynomial trendlines, the trendline order from 2 to 6. |
|
For moving average trendlines, the number of data points to include in the average. |
|
The number of periods or units to project the trendline forward beyond the plotted series. Default is 0. |
|
The number of periods or units to project the trendline backward beyond the plotted series. Default is 0. |
|
Where the trendline crosses the x-axis. If this argument is omitted, the intercept is automatically set by the regression. |
|
True displays the trendline formula as a data label; False does not. Default is False. |
|
True displays the trendline R-squared value as a data label; False does not. Default is False. |
|
The text to display in the chart legend for the trendline. Default is a brief, generated description of the trendline. |
The following code adds a polynomial trendline to the first series in a chart and forecasts the trend three units ahead of the last data point:
Sub AddPolyTrendline( ) Dim chrt As Chart, tl As Trendline, tls As Trendlines ' Get the ...
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.