LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default check if worksheet exists

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
check if worksheet exists joeeng Excel Worksheet Functions 3 September 7th 05 06:49 PM
check to see if sheet exists Wandering Mage Excel Programming 1 September 28th 04 07:53 PM
How to check if a worksheet exists in worksheet collection Raghunandan Excel Programming 2 July 19th 04 06:55 AM
Check whether a worksheet exists already clui[_6_] Excel Programming 2 December 3rd 03 05:19 PM
check if worksheet exists Craig Wilks Excel Programming 2 July 10th 03 04:07 AM


All times are GMT +1. The time now is 04:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"