Share via


NamedRange.DataSeries Method

Definition

Creates a data series in the NamedRange control.

public object DataSeries (object Rowcol, Microsoft.Office.Interop.Excel.XlDataSeriesType Type = Microsoft.Office.Interop.Excel.XlDataSeriesType.xlDataSeriesLinear, Microsoft.Office.Interop.Excel.XlDataSeriesDate Date = Microsoft.Office.Interop.Excel.XlDataSeriesDate.xlDay, object Step, object Stop, object Trend);
abstract member DataSeries : obj * Microsoft.Office.Interop.Excel.XlDataSeriesType * Microsoft.Office.Interop.Excel.XlDataSeriesDate * obj * obj * obj -> obj
Public Function DataSeries (Optional Rowcol As Object, Optional Type As XlDataSeriesType = Microsoft.Office.Interop.Excel.XlDataSeriesType.xlDataSeriesLinear, Optional Date As XlDataSeriesDate = Microsoft.Office.Interop.Excel.XlDataSeriesDate.xlDay, Optional Step As Object, Optional Stop As Object, Optional Trend As Object) As Object

Parameters

Rowcol
Object

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.

Date
XlDataSeriesDate

If the Type argument is xlChronological, the Date argument indicates the step date unit.Can be one of the following XlDataSeriesDate constants: xlDayxlWeekdayxlMonthxlYear

Step
Object

The step value for the series. The default value is 1 (one).

Stop
Object

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

Trend
Object

true to create a linear trend or growth trend; false to create a standard data series. The default value is false.

Returns

Examples

The following code example creates a series of twelve dates. The series contains the last day of every month in 1996.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange createMonthRange;
private void CreateMonthSeries()
{
    createMonthRange = this.Controls.AddNamedRange(
        this.Range["A1", "A12"], "createMonthRange");
    this.Range["A1"].Value2 = "31-JAN-1996";
    createMonthRange.DataSeries(missing,
        Excel.XlDataSeriesType.xlChronological, 
        Excel.XlDataSeriesDate.xlMonth, 1, false);
}
Private createMonthRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub CreateMonthSeries()
    createMonthRange = Me.Controls.AddNamedRange( _
        Me.Range("A1", "A12"), "createMonthRange")
    Me.Range("A1").Value2 = "31-JAN-1996"
    createMonthRange.DataSeries(, _
        Excel.XlDataSeriesType.xlChronological, _
        Excel.XlDataSeriesDate.xlMonth, 1, , False)
End Sub

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to