+ Reply to Thread
Results 1 to 2 of 2

Hide specific sheets on closing file

  1. #1
    Andy
    Guest

    Hide specific sheets on closing file

    Hi,

    little to no knowledge of VBA. I need some script that will automatically
    hide sheet x when I close the file. I then want to be able to unhide the
    sheet in the normal way when re-opening the file via Format > Sheet > Unhide.

    Thanks



  2. #2
    Norman Jones
    Guest

    Re: Hide specific sheets on closing file

    Try:

    '=============>>
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim SH As Worksheet
    Set SH = Me.Worksheets("Sheet3") '<<==== CHANGE
    SH.Visible = xlSheetHidden
    End Sub
    '<<=============

    This is workbook event code and should be pasted into the workbook's
    ThisWorkbook module *not* a standard module or a sheet module:

    Right-click the Excel icon on the worksheet
    (or the icon to the left of the File menu if your workbook is maximised)
    Select 'View Code' from the menu and paste the code.
    Alt-F11 to return to Excel.

    ---
    Regards,
    Norman


    "Andy" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > little to no knowledge of VBA. I need some script that will automatically
    > hide sheet x when I close the file. I then want to be able to unhide the
    > sheet in the normal way when re-opening the file via Format > Sheet >
    > Unhide.
    >
    > Thanks
    >
    >




+ 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