View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How2 Delete "Not exist" charts/sheets?

On Error Resume Next
Sheets("Chart TC123").Select
ActiveWindow.SelectedSheets.Delete
On Error goto 0

--
Regards,
Tom Ogilvy

"fatfish " wrote in message
...
Hi all,

I created the macro to delete charts..
Also I add a button to the menu and wanna click the button
to delete all the used charts.

The problem is: I wanna use one button to "clean" ALL the "used"
charts,
but some of those charts may not exist (because I use different macro
to
create different charts), so Excel can not find them and will ask me to
debug.
e.g.
Sheets("Chart TC123").Select
ActiveWindow.SelectedSheets.Delete

and "Chart TC123" doesn't exist!
How to avoid the error message?


---
Message posted from http://www.ExcelForum.com/