Results 1 to 4 of 4

Determining if a worksheet exists

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Question Determining if a worksheet exists

    Hi when I try to do the following I get an error 'Subscript out of range'

        If Not .Worksheets(ws_name_string) Is Nothing Then
    To do this do I HAVE to then have a worksheet variable to test against, such as:

    Dim ws as Worksheet
    
    With ThisWorkbook
        on error resume next
        Set ws = .worksheets(ws_name_string) 
        on error goto 0
        If Not ws Is Nothing Then
        ...
        ...
        End If
    End With
    I was hoping I might be able to achive the same test within one line?

    Thanks
    Last edited by Phil_V; 06-11-2009 at 06:06 AM.
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1