Link to home
Start Free TrialLog in
Avatar of ouestque
ouestqueFlag for United States of America

asked on

Excel VBA: Copy chart under different name

What VBA would I need to copy a chart to another sheet in the same place but with a new name and half its normal size.

In this case assume:
*The chart is titled "Chart1" on "Sheet1" and it is going to be copied to "Sheet2" with the name "New_Chart1"
*There are already various other random charts on Sheet1 and sheet2 with different names.
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ouestque

ASKER

Thank you Subodh. Will chartobjects.count always work? Is there a way to set the newly pasted object immediately to a variable instead?

Example: (Doesn't work)
Set ch2 = ws2.paste
Yes, it should work as it will always refer to the latest ChartObject copied to the Sheet2. Did it not work for you?
Thank you Subodh!
You're welcome!