+ Reply to Thread
Results 1 to 5 of 5

Hide worksheets at startup

  1. #1
    Sandy
    Guest

    Hide worksheets at startup

    Hello -

    I need to hide sheets when my app first begins (all except one). What is
    the best way to do this? I don't want to hide each one individually.

    Also, I'm assuming I would put the code in ThisWorkbook.

    Any help is appreciated!
    --
    Sandy

  2. #2
    Chip Pearson
    Guest

    Re: Hide worksheets at startup

    Sandy,

    Put the following code in the ThisWorkbook code module:

    Private Sub Workbook_Open()
    Dim WS As Worksheet
    For Each WS In Worksheets
    If WS.Name <> "The One You Don't Want To Hide" Then
    WS.Visible = xlSheetHidden
    End If
    Next WS
    End Sub


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Sandy" <[email protected]> wrote in message
    news:[email protected]...
    > Hello -
    >
    > I need to hide sheets when my app first begins (all except
    > one). What is
    > the best way to do this? I don't want to hide each one
    > individually.
    >
    > Also, I'm assuming I would put the code in ThisWorkbook.
    >
    > Any help is appreciated!
    > --
    > Sandy




  3. #3
    Peter Noneley
    Guest

    Re: Hide worksheets at startup

    Sandy,

    If you are hiding to prevent people seeing your data, maybe you should
    save the workbook with all but one sheet hidden, and then unhide the
    other sheets when the workbook is opened. This way, if a user disables
    macros they will only see the one sheet.

    You can use Chips code and change one line:

    WS.Visible = true

    Thats all, Good Luck!

    Peter Noneley
    Cardiff
    Wales
    UK

    Chip Pearson wrote:
    > Sandy,
    >
    > Put the following code in the ThisWorkbook code module:
    >
    > Private Sub Workbook_Open()
    > Dim WS As Worksheet
    > For Each WS In Worksheets
    > If WS.Name <> "The One You Don't Want To Hide" Then
    > WS.Visible = xlSheetHidden
    > End If
    > Next WS
    > End Sub
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    > "Sandy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello -
    > >
    > > I need to hide sheets when my app first begins (all except
    > > one). What is
    > > the best way to do this? I don't want to hide each one
    > > individually.
    > >
    > > Also, I'm assuming I would put the code in ThisWorkbook.
    > >
    > > Any help is appreciated!
    > > --
    > > Sandy



  4. #4
    Ron de Bruin
    Guest

    Re: Hide worksheets at startup

    Hi Peter

    Good to see you in the newsgroup
    I hope you are OK

    If you have a update of your "Excel Function Dictionary" or if
    your site is working again let me know and I change the link.

    http://www.rondebruin.nl/id.htm
    Bottom of the page

    Good night


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Peter Noneley" <[email protected]> wrote in message news:[email protected]...
    > Sandy,
    >
    > If you are hiding to prevent people seeing your data, maybe you should
    > save the workbook with all but one sheet hidden, and then unhide the
    > other sheets when the workbook is opened. This way, if a user disables
    > macros they will only see the one sheet.
    >
    > You can use Chips code and change one line:
    >
    > WS.Visible = true
    >
    > Thats all, Good Luck!
    >
    > Peter Noneley
    > Cardiff
    > Wales
    > UK
    >
    > Chip Pearson wrote:
    >> Sandy,
    >>
    >> Put the following code in the ThisWorkbook code module:
    >>
    >> Private Sub Workbook_Open()
    >> Dim WS As Worksheet
    >> For Each WS In Worksheets
    >> If WS.Name <> "The One You Don't Want To Hide" Then
    >> WS.Visible = xlSheetHidden
    >> End If
    >> Next WS
    >> End Sub
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >>
    >> "Sandy" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > Hello -
    >> >
    >> > I need to hide sheets when my app first begins (all except
    >> > one). What is
    >> > the best way to do this? I don't want to hide each one
    >> > individually.
    >> >
    >> > Also, I'm assuming I would put the code in ThisWorkbook.
    >> >
    >> > Any help is appreciated!
    >> > --
    >> > Sandy

    >




  5. #5
    Peter Noneley
    Guest

    Re: Hide worksheets at startup

    HI Ron,

    Yes, I've been away for a while, but hoping to get back into the swing
    of things!

    Peter.


+ 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