Charts.Add Method (Excel)

Creates a new chart sheet and returns a Chart object.

Syntax

expression .Add(Before, After, Count, Type)

expression A variable that represents a Charts object.

Parameters

Name

Required/Optional

Data Type

Description

Before

Optional

Variant

An object that specifies the sheet before which the new sheet is added.

After

Optional

Variant

An object that specifies the sheet after which the new sheet is added.

Count

Optional

Variant

The number of sheets to be added. The default value is one.

Count

Optional

Variant

An XlChartType constant that represents the type of chart to be added.

Return Value

A Chart object that represents the new chart sheet.

Remarks

If Before and After are both omitted, the new chart is inserted before the active sheet.

Example

This example creates an empty chart sheet and inserts it before the last worksheet.

ActiveWorkbook.Charts.Add Before:=Worksheets(Worksheets.Count)

See Also

Concepts

Charts Collection

Charts Object Members