View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default How to delete sheets with "Ch" in the sheet name?

If they are charts, then they are chart sheets, not worksheets. Worksheets
have rows and columns and cells and stuff.

Semantics aside, use the first to delete all chart sheets, or the second to
delete those with names containing "ch"

Sub DeleteAllChartSheets()
Application.DisplayAlerts = False ' suppress warning message
ActiveWorkbook.Charts.Delete
Application.DisplayAlerts = True
End Sub

Sub DeleteChartSheetsNamed_CH_()
Dim ch As Chart
For Each ch In ActiveWorkbook
If InStr(LCase$(ch.Name), "ch") 0 Then
ch.Delete
End If
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Terry" wrote in message
...
I need to delete all worksheets with name contains "Ch", from "Ch1" until
"Ch(n)". How to do it? All these sheets are charts.