Hi MeisterHim.
To delete all chart sheets in a workbook, try:
ActiveWorkbook.Charts.Delete
To delete all sheets except for specified sheets, try something like:
'=================
Public Sub Tester()
Dim SH As Object
Dim arrKeep As Variant
arrKeep = Array("Sheet1", "Sheet5", "Sheet7")
Application.DisplayAlerts = False
For Each SH In ActiveWorkbook.Sheets
If IsError(Application. _
Match(SH.Name, arrKeep, 0)) Then
SH.Delete
End If
Next SH
Application.DisplayAlerts = True
End Sub
'<<=================
Change the names in arrKeep to reflect the sheets to be retained.
---
Regards,
Norman
"MeisterHim" wrote
in message ...
Hi.
I want to delete graphsheets automatically if they exists. The code
Sheets("Graph1").Delete will give an error when the graph doesn't
exists. If there is no possible way of doing this, maybe there is a way
to delete all the sheets with the exclusion of a few that i DO want to
keep.
Thanks for your help in advance.
--
MeisterHim
------------------------------------------------------------------------
MeisterHim's Profile:
http://www.excelforum.com/member.php...o&userid=27401
View this thread: http://www.excelforum.com/showthread...hreadid=472284