+ Reply to Thread
Results 1 to 14 of 14

Password Protect Multiple Sheets

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Password Protect Multiple Sheets

    Hi all,

    I use the following code on a Userform to display all sheets in a listbox.
    After hitting the CommandButton it will go to the selected sheet on the listbox.

    I'd now like to make some of the sheets accessible with a password only.
    I have no idea how to do this though.

    Any ideas?



    Please Login or Register  to view this content.
    Last edited by Jonathan78; 04-08-2011 at 02:27 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Password Protect Multiple Sheets

    This should be simple enough to customize:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Password Protect Multiple Sheets

    Hello JBeaucaire,

    When I hit the button with your code, nothing happens?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Password Protect Multiple Sheets

    I don't see a workbook with a button you want me to troubleshoot. Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Password Protect Multiple Sheets

    See if this helps, you can set sheets visible or not for each user


    PASSWORD FORM4.zip
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Password Protect Multiple Sheets

    Hi guys,
    Book1.xls This a sample of the code I gave in my first post.
    I'd like to make some sheets inaccessible by giving it a password. [in the example: Ernest and John]

    Sheet tabs will be made invisible later on.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Password Protect Multiple Sheets

    It's impossible for us to check your work if you don't show it. Your workbook above does not have the macro code I provided installed with the appropriate changes (sheet tab names...you did read the code, yes?), so how are we to review your attempts?

    When I put the code I gave into the same place as your current code and edited the macro to list the actual sheet names to protect in your sample wb, it worked as shown.

  8. #8
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Password Protect Multiple Sheets

    Hello JBeaucaire,

    Sorry for that.
    I now attached the file with your code in it.
    As you see, it does nothing
    Attached Files Attached Files

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Password Protect Multiple Sheets

    Read the code I gave you. Make sure you understand it, because it is glaringly obvious I put generic sheet names into the macro expecting you to edit them to the sheet names you want to PASSWORD protect. I even put in a generic password you would need to edit, too.

    Edit the macro (as I already pointed out in post #7) and it works.

    (nudge)(poke)

  10. #10
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Password Protect Multiple Sheets

    I got it working now.
    However I don't want all sheets to be protected.
    Is it possible to make some accessible without a password?

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Password Protect Multiple Sheets

    Yes, leave those sheets off the list in the macro.

    Try this, this version shows TWO sheets with password protection, the others have none:
    Please Login or Register  to view this content.


    Also, this code will make all your sheets hide themselves when you leave the sheets. Put this macro into your ThisWorkbook module.
    Please Login or Register  to view this content.

    Notice the way these sheets are hidden, they can only be unhidden with VBA, there is no menu command a user can use to unhide sheets manually hidden this way. This increases the likelihood that hidden sheets will remain hidden, even if the user opens the workbook with macros disabled.

  12. #12
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Password Protect Multiple Sheets

    SUGGESTION For Accessing List Values


    All of this ...
    Please Login or Register  to view this content.
    Can be repalaced by this ....

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Password Protect Multiple Sheets

    Hello Jonathan78 & JBeaucaire:

    SECURITY THROUGH OBSCURITY
    With the current solution, you have everyone that uses the UserForm seeing the list of all sheets available. Just wondering if you really want people to know there are sheets that they aren't supposed to look at ? The following solution asks for an admin password during the initialization of the userform.... with this approach you must enter an admin password to see the Admins Sheets in the the list. This way non-Admins don't even know that the "other" sheets exist so less temptation to get into the restricted sheets. With this solution there is no need to ask for a password each time an Admin clicks on a specific sheet ... because if it's in the list it's a sheet the person is alllowed to see.

    Please Login or Register  to view this content.
    Last edited by nimrod; 04-07-2011 at 08:43 PM.

  14. #14
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Password Protect Multiple Sheets

    Thanks JBeaucaire this works just great!.

    Quite interesting nimrod, I'll not use it now, but this could be very helpfull 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