+ Reply to Thread
Results 1 to 2 of 2

Worksheet Exists? Invisible Worksheets?

  1. #1
    Ken Loomis
    Guest

    Worksheet Exists? Invisible Worksheets?

    I need to test for the existence of a specific worksheet in the active
    workbook.

    The sheet name will always be "OldFiles" and I need to create it if is
    doesn't exist.

    Also, is there a way to make the new sheet ("OldFiles") invisible?

    Ken




  2. #2
    Norman Jones
    Guest

    Re: Worksheet Exists? Invisible Worksheets?

    Hi Ken,

    Try:

    Sub TestIt()

    If Not SheetExists("Oldfiles", ActiveWorkbook) Then
    Worksheets.Add
    With ActiveSheet
    .Name = "OldFiles"
    .Visible = xlVeryHidden
    End With
    End If
    End Sub

    Function SheetExists(SName As String, _
    Optional ByVal WB As Workbook) As Boolean
    'Chip Pearson
    On Error Resume Next
    If WB Is Nothing Then Set WB = ThisWorkbook
    SheetExists = CBool(Len(WB.Sheets(SName).Name))
    End Function


    ---
    Regards,
    Norman



    "Ken Loomis" <[email protected]> wrote in message
    news:[email protected]...
    >I need to test for the existence of a specific worksheet in the active
    >workbook.
    >
    > The sheet name will always be "OldFiles" and I need to create it if is
    > doesn't exist.
    >
    > Also, is there a way to make the new sheet ("OldFiles") invisible?
    >
    > Ken
    >
    >
    >




+ Reply to Thread

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