Trendlines.Add Method
Creates a new trendline. Returns a Trendline object.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function Add ( _
Type As XlTrendlineType, _
Order As Object, _
Period As Object, _
Forward As Object, _
Backward As Object, _
Intercept As Object, _
DisplayEquation As Object, _
DisplayRSquared As Object, _
Name As Object _
) As Trendline
'Usage
Dim instance As Trendlines
Dim Type As XlTrendlineType
Dim Order As Object
Dim Period As Object
Dim Forward As Object
Dim Backward As Object
Dim Intercept As Object
Dim DisplayEquation As Object
Dim DisplayRSquared As Object
Dim Name As Object
Dim returnValue As Trendline
returnValue = instance.Add(Type, Order, _
Period, Forward, Backward, Intercept, _
DisplayEquation, DisplayRSquared, _
Name)
Trendline Add(
XlTrendlineType Type,
Object Order,
Object Period,
Object Forward,
Object Backward,
Object Intercept,
Object DisplayEquation,
Object DisplayRSquared,
Object Name
)
Parameters
Type
Type: Microsoft.Office.Interop.Excel.XlTrendlineTypeOptional XlTrendlineType. The trendline type.
Order
Type: System.ObjectOptional Object. Required if Type is xlPolynomial. The trendline order. Must be an integer from 2 to 6, inclusive.
Period
Type: System.ObjectOptional Object. Required if Type is xlMovingAvg. The trendline period. Must be an integer greater than 1 and less than the number of data points in the series you're adding a trendline to.
Forward
Type: System.ObjectOptional Object. The number of periods (or units on a scatter chart) that the trendline extends forward.
Backward
Type: System.ObjectOptional Object. The number of periods (or units on a scatter chart) that the trendline extends backward.
Intercept
Type: System.ObjectOptional Object. The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.
DisplayEquation
Type: System.ObjectOptional Object. True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default value is False.
DisplayRSquared
Type: System.ObjectOptional Object. True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default value is False.
Name
Type: System.ObjectOptional Object. The name of the trendline as text. If this argument is omitted, Microsoft Excel generates a name.
Return Value
Type: Microsoft.Office.Interop.Excel.Trendline