Macros to Protect/Unprotect Worksheets and Workbooks

  • Re: Macros to Protect/Unprotect Worksheets and Workbooks


    I need a revise code for these current code that i posted, since i cannot work into it..

    my problem is, everytime i put a password on the protectall, it overwrites the previous password i already put it in.
    for example, i put 12345 password for the first time and it did protect the whole sheet, but when i try to input another password for example 67890, it overwrites the 12345??

    thanks for the help..

  • Re: Macros to Protect/Unprotect Worksheets and Workbooks

    I have seen this issue come up a few times on multiple forums and asked a multitude of diferent ways.
    It was a very frustrating problem and I hope this can be useful to anyone.

    Here is reletively simple code that I have pulled together form many sources and then customizing it.
    This code will use a command button to unprotect all worksheets within a workbook and notify the user of the state of the worksheets.

    The password can be changed to whatever personal choice you would like.
    For general protection without a password, simply leave the password as, =""

    For any cells that need to remain unprotected, simply uncheck the "locked" box in "format cells", "protection".

    I have found that hiding a worksheet with this button then protecting the workbook keeps things pretty tight.
    Also PW protect your code.

    I hope this helps,

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!