+ Reply to Thread
Results 1 to 7 of 7

Prevent User from unhiding sheet

  1. #1
    Forum Contributor vandanavai's Avatar
    Join Date
    09-04-2006
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    256

    Prevent User from unhiding sheet

    Hello,

    I have workbook with 3 sheets. User is required to enter data by using 'User Form' designed for the same. Entered data is transferred to sheet 'Data' which is hidden sheet. I don't want user to unhide sheet 'Data' and make any changes. User can always unhide sheet by using menu Format-sheet-unhide.
    How to prevent user from unhiding sheet?

    Please help me.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    In VBA, you can use the following:
    Please Login or Register  to view this content.
    This will allow only VBA to unhide the sheet.

  3. #3
    Forum Contributor vandanavai's Avatar
    Join Date
    09-04-2006
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    256
    Thanks jasoncw. It worked in manner I wanted. If password can be added in this code so that only one who know password can unhide sheet?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Since the only way to unhide is via VBA, then you can protect your VBA project. With the file open, go to the VBE, then Tools > Properties. On the protection tab, check the box and add a password.

  5. #5
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Prevent User from unhiding sheet

    Quote Originally Posted by jasoncw View Post
    Since the only way to unhide is via VBA, then you can protect your VBA project. With the file open, go to the VBE, then Tools > Properties. On the protection tab, check the box and add a password.
    Hi, it is unfortunately very easy to change visibility simply by pressing ALT+F11 and changing the Visibility property from "xlVeryHidden" to "xlSheetVisible". However it's true that adding a password to VBA prevents anybody who does not have the pwd to change the visibility.

    My concern however is about Activation of Macros and VB code.
    If a user has configured his excel to DISABLE Macros and VB, xml etc. then probably the VB code below will not run while sitting in section WorkBook_Open (runs when workbook opens) ??
    Or will it still run and hide the wanted sheets/Tabs ?

    Please Login or Register  to view this content.
    Last edited by arlu1201; 05-14-2014 at 01:34 AM. Reason: Use code tags.

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Prevent User from unhiding sheet

    Quote Originally Posted by Imrana View Post
    My concern however is about Activation of Macros and VB code.
    If a user has configured his excel to DISABLE Macros and VB, xml etc. then probably the VB code below will not run while sitting in section WorkBook_Open (runs when workbook opens) ??
    Or will it still run and hide the wanted sheets/Tabs ?
    If an Excel user opens a workbook without enabling macros, no code runs. This includes event procedures such as Workbook_Open

    The solution to this problem is to use code so that the workbook is unusable unless the user enables macros. i.e. FORCE users to enable macros.

    Multiple versions of 'Force Enable Macros' code exists (google). Here's one: http://xl-central.com/force-users-to...-workbook.html

    Obviously you would need to edit this code so that the sheets you wish to keep veryhidden are not made visible once the user enables macros. HTH
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  7. #7
    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,198

    Re: Prevent User from unhiding sheet

    Hi, Imrana,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    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

+ 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