Tuesday, May 26, 2009

Delete All the Charts in Excel (through VBA)

Just needed to delete a lot of charts. I'm generating some as well and all the practice charts are building up.

********************************
For i = 1 To ActiveSheet.ChartObjects.Count 'Cycle through the Charts
ActiveSheet.ChartObjects(i).Delete ' Delete each Chart
Next i 'NEXT CHART
**********************************

The bulk of the code is in this loop. Surrounding code is pretty easy

No comments:

Post a Comment