Deleting All charts using VB

  • Thread starter Thread starter BrownTing
  • Start date Start date
B

BrownTing

Hi Everyone,

Essentially I have made a program that produces charts as a new
worksheet (Chartsheet); however I have some code that works on the
number of worksheets produced and will mess up when more charts are
added. I cannot modify the code nor produce charts inside of a
worksheet but this will cause more problems.

My question:

Does anyone know a command in Visual Basic that deletes charts produced
as worksheets (chartsheet)?

-Identify a charts produced as a worksheets (tab)
-delete charts (without a specific tab name) (Ex. Chart 1, Chart
2…..ect)
-delete all charts without referring to their name.

Thanks
 
Try

Dim CH As Chart
Application.DisplayAlerts = False
For Each CH In ThisWorkbook.Charts
CH.Delete
Next CH
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"BrownTing"
message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top