What if you wanted a macro to look thru the workbook and delete all th
sheets named Chart*? How would you get a macro to look through th
whole workbook
Application.DisplayAlerts = False
On Error Resume Next
For Each mySheet In ActiveWorkbook.Sheets
If LCase(mySheet.Name) Like "chart*" Then
mySheet.Delete
End If
Next mySheet
On Error GoTo 0
Application.DisplayAlerts = True
End Sub
The ".displayalerts = false" stops the "are you sure" prompts.
The "on error" stuff prevents an error if you try to delete the only visible
sheet remaining. (There always has to be at least one visible sheet in your
workbook.)
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.