Skip to main content

ChartObject object

Table of contents
  1. Remarks
  2. Example

Represents an embedded chart on a worksheet.

Remarks

The ChartObject object acts as a container for a Chart object. Properties and methods for the ChartObject object control the appearance and size of the embedded chart on the worksheet.

The ChartObject object is a member of the ChartObjects collection. The ChartObjects collection contains all the embedded charts on a single sheet.

Use ChartObjects (index), where index is the embedded chart index number or name, to return a single ChartObject object.

Example

The following example sets the pattern for the chart area in embedded Chart 1 on the worksheet named Sheet1.

Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.Format.Fill.Pattern = msoPatternLightDownwardDiagonal

The embedded chart name is shown in the Name box when the embedded chart is selected. Use the Name property to set or return the name of the ChartObject object. The following example puts rounded corners on the embedded chart named Chart 1 on the worksheet named Sheet1.

Worksheets("sheet1").ChartObjects("chart 1").RoundedCorners = True

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>