Trendline.Period property (Word)

Returns or sets the period for the moving-average trendline. Read/write Long.

Syntax

expression. Period

expression A variable that represents a 'Trendline' object.

Remarks

This property can have a value from 2 through 255.

Example

The following example sets the period for the moving-average trendline on the first chart in the active document. You should run the example on a 2D column chart that has a single series that contains 10 data points and a moving-average trendline.

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart.SeriesCollection(1).Trendlines(1) 
 If .Type = xlMovingAvg Then .Period = 5 
 End With 
 End If 
End With

See also

Trendline Object

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.