G
Guest
I have a very simple subroutine that deletes certain worksheets.
Unfortunately, the macro crashes if the worksheet does not exist (not the
usual case, but does happen).
Sheets("Summary").Select
ActiveWindow.SelectedSheets.Delete
....and so on, with other sheet names (but not all the sheet names)...
I tried:
If Sheets("Summary") Is Nothing Then
....
End If
That gives me a "Run-time error '9': Subscript out of range" error.
How can I check to see if this sheet exists before trying to delete it?
Thank you,
Judy
Unfortunately, the macro crashes if the worksheet does not exist (not the
usual case, but does happen).
Sheets("Summary").Select
ActiveWindow.SelectedSheets.Delete
....and so on, with other sheet names (but not all the sheet names)...
I tried:
If Sheets("Summary") Is Nothing Then
....
End If
That gives me a "Run-time error '9': Subscript out of range" error.
How can I check to see if this sheet exists before trying to delete it?
Thank you,
Judy