+ Reply to Thread
Results 1 to 12 of 12

Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    Netherlands
    MS-Off Ver
    2007 on Win 7
    Posts
    50

    Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi all.

    Maybe somebody knows a lot more about SheetVisibility.xlSheetVeryHidden than I do.

    I want some sheet in my workbook (not all) to really hide so that they can't be seen in the "right-click on the tabs and unhide" way.

    I know that you have to use the following code for it
    Please Login or Register  to view this content.
    But how can I put this code in each sheet which I want to really hide?

    Can somebody give me an example ?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi, mbdigital,

    no need to put the code in any sheet - you could place it in ThisWorkbook and refer to each worksheet by name.

    Code may lok like this (standard module, adjust the sheet names to suit and add more if needed):
    Please Login or Register  to view this content.
    This code must be started one way or another, could be the opening of the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    09-10-2014
    Location
    Netherlands
    MS-Off Ver
    2007 on Win 7
    Posts
    50

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi Holger.

    Thanks for your (super quick) help in this.

    You said "the code must be started ...."

    I have already the following (very big but I will only display the beginning here) code to show some sheets depending on some cell-values :

    Can I put your code somewhere between this ?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi, mbdigital,

    maybe just replace the values for True and False (visible and hidden) accordingly:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    09-10-2014
    Location
    Netherlands
    MS-Off Ver
    2007 on Win 7
    Posts
    50

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi Holger.

    This works very good.
    Thanks for this !!

    The only thing I would like to ask is the following :

    Untill now I have used this code with some extra commands, like Select "Case Worksheets" and so on.

    Is there a way to tell to a sheet (maybe in the code of this particular sheet ??) that it has to be VeryHidden always ?
    Because now when a (secret) macro is called to unhide a page and later on it is hidden again (via the normal right-click on the tab and choose hide)
    the page is not VeryHidden anymore.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi, mbdigital,

    I must admit I lack the understanding of making a very hidden sheet visible to any user (except Admin/Programmer where I use a different approach by checking the username on the system due to working on different PC).

    If it´s just one of any sheets at a time adjust the code names of the sheets you will find in the project explorer. Code goes into ThisWorkbook:
    Please Login or Register  to view this content.
    If more than one sheet has been made visible use a loop over all sheets, compare the codename and take action as needed making sure that at least one sheet remains visible within the workbook.

    Ciao,
    Holger

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    To permanently VeryHide a worksheet, you can go into the VB Editor, select the sheet from the Excel Objects list and use the Proprerty Window to set the default visibility.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Registered User
    Join Date
    09-10-2014
    Location
    Netherlands
    MS-Off Ver
    2007 on Win 7
    Posts
    50

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi mike. Can you please give me an example of this code?
    I'm not so good in VBA codes. Have to learn a lot as beginner.

  9. #9
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    I was describing a way to VeryHide a worksheet without using code.
    At design time, one can use the Property Window to set the .Visible property of a worksheet.

    You don't need any code (unless you want to un-hide it during run time)

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hi, mikerickson,

    Quote Originally Posted by Post #5
    Because now when a (secret) macro is called to unhide a page and later on it is hidden again (via the normal right-click on the tab and choose hide)
    the page is not VeryHidden anymore.
    I wonder what´s the use to explain how to hide a sheet via the project explorer when VBA is used to make it visible - I´d used some VBA to make it very hidden again. But I´m certainly mistaken by thinking so.

    Ciao,
    HOlger

  11. #11
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    I didn't read closely.

    A different version of your approach (depending on the desrired user experience) would be to put this in particular sheets' code modules. This would make those sheets sometimes visibile, sometimes VeryHidden, but (simple) Hideable only via code.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-10-2014
    Location
    Netherlands
    MS-Off Ver
    2007 on Win 7
    Posts
    50

    Re: Want to REALLY hide some sheets with Excel.XlSheetVisibility.xlSheetVeryHidden

    Hey Mike.

    This is exactly what I was looking for.
    And it works perfect!

    Thanks for your help (also many thanks to Holger for your great help)

    Best regards,
    Maarten (Netherlands)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. NEED HELP PLEASE!! VBA code to xlSheetVeryHidden
    By lester.ilao in forum Excel General
    Replies: 3
    Last Post: 10-28-2014, 10:14 PM
  2. Hide Sheets in Excel after Sheet#...
    By rarascon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2013, 02:14 PM
  3. Replies: 0
    Last Post: 02-24-2010, 07:27 AM
  4. Problems with XLSheetVeryHidden
    By alderran in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2007, 05:58 AM
  5. [SOLVED] Opeations on xlSheetVeryHidden worksheet
    By Frederick Chow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2005, 03:06 PM

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