troubleshooting Question

Replace all charts with pictures on a worksheet?

Avatar of daviddiebel
daviddiebel asked on
Visual Basic ClassicMicrosoft ExcelVB Script
3 Comments1 Solution358 ViewsLast Modified:
I'm trying to copy all charts on a worksheet as pictures, and then delete all of the original charts.  What I have for code right now is:

Sub ConvertCharttoPicture()

Dim i As Integer
Dim intX As Integer

For i = 1 To ActiveSheet.ChartObjects.Count
        ActiveSheet.ChartObjects(i).Activate
        ActiveSheet.ChartObjects(i).Select
        ActiveChart.ChartArea.Select
        ActiveChart.CopyPicture _
        Appearance:=xlPrinter, Size:=xlScreen, Format:= _
        xlPicture
        ActiveChart.Paste

Next

End Sub

One problem is that I cannot figure out how to delete the original chart.  The second problem is that this loops indefinitely, going over the same chart, again and again.  Any assistance at making this work would be great!  I intend to use this on many, many worksheets as part of another macro.

Thank you!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros