Moving from Embedded to Chart Sheet and Vice Versa

The Location method is the equivalent of right-clicking a chart (embedded or in its own sheet) and selecting Location from the shortcut menu. The method is put to use when you want to change an embedded chart to a chart sheet or vice versa.

Consider the code:

Worksheets("Sheet1").ChartObjects("Chart 1").Activate ActiveChart.Location Where:=xlLocationAsNewSheet, Name:= "MyChart"

When this code is run, it changes the embedded chart, Chart 1 on Sheet1, to a chart sheet named MyChart.

0 0

Post a comment