The complete syntax is Cht.Location(Where, Name)

The possible values of the Where argument are xlLocationAsNewSheet and xlLocationAsObject, or xlLocationAutomatic.

Name is a string which specifies

■ The name of the chart sheet to convert the embedded chart to when Where is xlLocationAsNewSheet

■ The name of the sheet that will hold the embedded chart sheet when Where is xlLocationAsObject

The macro recorder often records unnecessary code. This is one such example. Notice that when we used the line Charts.Add, we already specified that the chart would be on a new chart sheet. So when a chart is created on a new sheet, the code works even if this line is deleted.

Was this article helpful?

0 0

Post a comment