ClearContents method (Excel Graph)

The ClearContents method as it applies to the ChartArea and Range objects.

ChartArea object

Clears the data from a chart but leaves the formatting.

Syntax

expression.ClearContents

expression Required. An expression that returns a ChartArea object.

Range object

Clears the formulas from the range.

Syntax

expression.ClearContents

expression Required. An expression that returns a Range object.

Example

This example clears the formulas from cells A1:G37 on the datasheet but leaves the formatting intact.

myChart.Application.DataSheet.Range("A1:G37").ClearContents

This example clears the chart data from a chart but leaves the formatting intact.

myChart.ChartArea.ClearContents

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.