ClearContents Method

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

ClearContents method as it applies to the ChartArea object.

Clears the data from a chart but leaves the formatting.

expression.ClearContents

expression Required. An expression that returns one of the above objects.

ClearContents method as it applies to the Range object.

Clears the formulas from the range.

expression.ClearContents

expression Required. An expression that returns one of the above objects.

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
Show: