This documentation is archived and is not being maintained.

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)

'Usage
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
Dim trendlines1 As Trendlines
returnValue = trendlines1.Add(Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

Trendline Add(
	[In, Optional] XlTrendlineType Type, 
	[In, Optional] object Order, 
	[In, Optional] object Period, 
	[In, Optional] object Forward, 
	[In, Optional] object Backward, 
	[In, Optional] object Intercept, 
	[In, Optional] object DisplayEquation, 
	[In, Optional] object DisplayRSquared, 
	[In, Optional] object Name
);
public Trendline Add(
	/*in*/XlTrendlineType Type, 
	/*in*/System.Object Order, 
	/*in*/System.Object Period, 
	/*in*/System.Object Forward, 
	/*in*/System.Object Backward, 
	/*in*/System.Object Intercept, 
	/*in*/System.Object DisplayEquation, 
	/*in*/System.Object DisplayRSquared, 
	/*in*/System.Object Name
);
function Add(
	 Type : XlTrendlineType, 
	 Order : Object, 
	 Period : Object, 
	 Forward : Object, 
	 Backward : Object, 
	 Intercept : Object, 
	 DisplayEquation : Object, 
	 DisplayRSquared : Object, 
	 Name : Object
) : Trendline;

Parameters

Type

Optional XlTrendlineType. The trendline type.

Order

Optional Object. Required if Type is xlPolynomial. The trendline order. Must be an integer from 2 to 6, inclusive.

Period

Optional 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

Optional Object. The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward

Optional Object. The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept

Optional Object. The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.

DisplayEquation

Optional 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

Optional 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

Optional Object. The name of the trendline as text. If this argument is omitted, Microsoft Excel generates a name.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Show: