Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 1.33 KB

Excel.ChartObjects.Add.md

File metadata and controls

52 lines (32 loc) · 1.33 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ChartObjects.Add method (Excel)
vbaxl10.chm497103
vbaxl10.chm497103
Excel.ChartObjects.Add
46f28b34-83a5-b3d9-c19b-a1dc8e05dff7
04/20/2019
medium

ChartObjects.Add method (Excel)

Creates a new embedded chart.

Syntax

expression.Add (Left, Top, Width, Height)

expression A variable that represents a ChartObjects object.

Parameters

Name Required/Optional Data type Description
Left Required Double The initial coordinates of the new object (in points), relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.
Width Required Double The initial size of the new object, in points.

Return value

A ChartObject object that represents the new embedded chart.

Example

This example creates a new embedded chart.

Set co = Sheets("Sheet1").ChartObjects.Add(50, 40, 200, 100) 
co.Chart.ChartWizard Source:=Worksheets("Sheet1").Range("A1:B2"), _ 
 Gallery:=xlColumn, Format:=6, PlotBy:=xlColumns, _ 
 CategoryLabels:=1, SeriesLabels:=0, HasLegend:=1

[!includeSupport and feedback]