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

Tuesday, May 19, 2009

Escape Hard Return in VBA

It's always a pain to remember a hard return in VBA.  So I thought I'd get it documented.  There is actually more than one. I may post the differences in a future post.
---- CODE ------
vbCrLf
vbNewLine

---- END CODE  ------