+ Reply to Thread
Results 1 to 6 of 6

Password access to sheet - have code need help improving

  1. #1
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2013
    Posts
    177

    Password access to sheet - have code need help improving

    Hi all,
    I've found the following code on the net which seems to do the job for me (I want to users to require a password to access a sheet in my wb).

    However, if you click cancel when you have clicked on tab ProgressCompCriteria (e.g. you don't have the password and are cancelling off) the whole wb closes. I want it to return to sheet 'Menu' instead.

    Cheers, Luke [ATTACH](file here)212679[/ATTACH]

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    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: Password access to sheet - have code need help improving

    Quote Originally Posted by lukestkd View Post
    tab ProgressCompCriteria
    No tab named ProgressCompCriteria. Did you mean "PercentCompCriteria" instead? Or could the "ProgressCompCriteria" tab have been deleted?
    Last edited by mc84excel; 02-06-2013 at 07:03 PM. Reason: clarify
    *******************************************************

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

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

  3. #3
    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: Password access to sheet - have code need help improving

    Assuming you meant the tab "PercentCompCriteria" then go the 'ThisWorkbook' module and replace the Workbook_SheetActivate code with the one below:

    Please Login or Register  to view this content.

  4. #4
    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: Password access to sheet - have code need help improving

    I should warn you that this code is not very secure. It can be easily bypassed if the end user refuses to enable macros. (You could work around this by forcing users to enable macros but that's a topic for another thread).

  5. #5
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2013
    Posts
    177

    Re: Password access to sheet - have code need help improving

    Quote Originally Posted by mc84excel View Post
    I should warn you that this code is not very secure. It can be easily bypassed if the end user refuses to enable macros. (You could work around this by forcing users to enable macros but that's a topic for another thread).

    Works perfectly for what I need! Many thanks for this mc!

  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: Password access to sheet - have code need help improving

    Quote Originally Posted by lukestkd View Post
    Works perfectly for what I need! Many thanks for this mc!
    Glad to help.

    (Just as long as you are aware that this password protection is extremely insecure. It can be broken quite easily and - if the end user did not enable macros when opening the workbook - even bypassed accidentally).

+ 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