Charts.Add Method (Excel)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Charts.Add Method (Excel)

Office 2010

Creates a new chart sheet and returns a Chart object.

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.

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

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

ActiveWorkbook.Charts.Add Before:=Worksheets(Worksheets.Count)
Show:
© 2016 Microsoft