DataSeries Method

Microsoft Excel Visual Basic

expression.DataSeries(Rowcol, Type, Date, Step, Stop, Trend)

expression    Required. An expression that returns one of the objects in the Applies To list.

Rowcol   Optional Variant. Can be the xlRows or xlColumns constant to have the data series entered in rows or columns, respectively. If this argument is omitted, the size and shape of the range is used.

Type   Optional XlDataSeriesType.

XlDataSeriesType can be one of these XlDataSeriesType constants.
xlAutoFill
xlDataSeriesLinear default
xlChronological
xlGrowth

Date   Optional XlDataSeriesDate. If the Type argument is xlChronological, the Date argument indicates the step date unit.

XlDataSeriesDate can be one of these XlDataSeriesDate constants.
xlDay default
xlWeekday
xlMonth
xlYear

Step   Optional Variant. The step value for the series. The default value is 1.

Stop   Optional Variant. The stop value for the series. If this argument is omitted, Microsoft Excel fills to the end of the range.

Trend   Optional Variant. True to create a linear trend or growth trend. False to create a standard data series. The default value is False.

Example

This example creates a series of 12 dates. The series contains the last day of every month in 1996 and is created in the range A1:A12 on Sheet1.

Set dateRange = Worksheets("Sheet1").Range("A1:A12")
Worksheets("Sheet1").Range("A1").Formula = "31-JAN-1996"
dateRange.DataSeries Type:=xlChronological, Date:=xlMonth