If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > determine if a sheet name exists

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-12-09, 11:18
mikezx10 mikezx10 is offline
Registered User
 
Join Date: Oct 2003
Posts: 226
determine if a sheet name exists

Rather than going through each sheet in a work book, is there another way to determine if a sheet exists??
Reply With Quote
  #2 (permalink)  
Old 06-12-09, 12:18
Ax238 Ax238 is offline
Registered User
 
Join Date: May 2009
Posts: 257
Sure, the following code will do it:
Code:
    Dim ws As Worksheet, Exists As Boolean
    On Error Resume Next
    Set ws = ActiveWorkbook.Sheets("SheetName")
    Exists = Not ws Is Nothing
    On Error GoTo 0
Regards,

Ax
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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