Chart.Location method (Excel)

Moves the chart to a new location.

Syntax

expression.Location (Where, Name)

expression An expression that returns a Chart object.

Parameters

Name Required/Optional Data type Description
Where Required XlChartLocation Where to move the chart.
Name Optional Variant Required if Where is xlLocationAsObject. The name of the sheet where the chart will be embedded if Where is xlLocationAsObject, or the name of the new sheet if Where is xlLocationAsNewSheet.

Return value

The new Chart at the new location. Note that the Location method deletes the old chart and creates a new one in the new location. As a result, the old chart is invalidated and subsequent operations on it is not well defined.

Example

This example moves the embedded chart to a new chart sheet named Monthly Sales, and assigns the new chart to newChart.

Set newChart = Worksheets(1).ChartObjects(1).Chart _ 
 .Location(xlLocationAsNewSheet, "Monthly Sales")

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.