Name
chart.Location(Where, [Name])
Synopsis
Moves the chart to a new worksheet or chart sheet.
|
Argument |
Settings |
|---|---|
|
|
An |
|
|
The name of the target worksheet or chart sheet. |
The Location method removes the chart from its current location and inserts it in the new location. For example, the first procedure in the following code block removes the chart sheet New Chart and inserts the chart as an embedded object on the Start worksheet; the second procedure moves the embedded chart back to a chart sheet:
Sub MoveChartToStart( )
Dim chrt As Chart
Set chrt = Charts("New Chart")
chrt.Location xlLocationAsObject, "Start"
End Sub
Sub MoveChartBack( )
Dim chrt As Chart
Set chrt = Worksheets("Start").ChartObjects(1).Chart
chrt.Location xlLocationAsNewSheet
ActiveSheet.Name = "New Chart"
End SubBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access