+ Reply to Thread
Results 1 to 9 of 9

Password protect worksheet.

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Password protect worksheet.

    I am trying to find a way to have this macro run each time the work book is opened. At this point once the password is entered the sheet is unprotected until someone reruns the macro.

    What would be best is if this work sheet was protected in such a way, that if someone clicked on the tab to open the sheet they were prompted for a password. once the password is entered they have full editing capabilities. Then when the work book is closed and opened again the password restriction would be reset. I don't know if this is possible but it sure would be nice.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Password protect worksheet.

    How to run macros on a protected sheet
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    03-02-2012
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Password protect worksheet.

    Palmetto,
    Thanks, That worked perfect for getting the worksheet to be protected upon start up.
    Now If I could just get the password screen to pop up when ever that sheet is selected life would be grand.
    Basically
    If sheet1 is active then enter password
    if the password is false then protect the sheet
    if the password is true then unprotect the sheet

    Please Login or Register  to view this content.
    This is what I ended up with only in a different location then the other and I took out all the other stuff I did not need for this application. I am surprised at how close I was on my last attempt. This must mean I am learning something.

    Anyone want to take a crack at the second half of this? You would be my friend forever!

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Password protect worksheet.

    maybe this
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Password protect worksheet.

    Now If I could just get the password screen to pop up when ever that sheet is selected life would be grand.
    Using the worksheet_activate event

    Please Login or Register  to view this content.
    Caution: you should probably use the worksheet deactivate event to automatically turn on sheet protection when leaving the sheet.

  6. #6
    Registered User
    Join Date
    03-02-2012
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Password protect worksheet.

    Ok I am so close. I have no idea why this wont work. In this version of the code the password box will not come up at all.
    Please Login or Register  to view this content.
    If I remove the if statement it works ok.

    Please Login or Register  to view this content.
    The only problem here is that once the password has been entered every time that sheet it brought up it brings up the dialog box again. This time it wants to protect the document. I only want it to bring up the password box if the document is protected.
    Thanks

  7. #7
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Password protect worksheet.

    or
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-02-2012
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Password protect worksheet.

    Amazing John,
    This is perfect.
    Thanks Bob

  9. #9
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Password protect worksheet.

    hi,
    Thank you and glad it helped you! The rep goes to Palmetto!

+ 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