Forum Discussion

JennW_IWCO's avatar
JennW_IWCO
Copper Contributor
Sep 18, 2023
Solved

Disable View Code in Protected Worksheets

I have looked everywhere, but can find no answer to my question. I am using some VBA to dynamically show and hide rows and columns based on selections in my worksheets. In attempting to protect these...
  • HansVogelaar's avatar
    Sep 18, 2023

    JennW_IWCO 

    Activate the Visual Basic Editor.

    Select Tools > VBAProject Properties...

    Activate the Protection tab.

    Tick the check box 'Lock project for viewing'.

    Enter a password in the Password box, and enter it again in the 'Confirm password' box.

    Don't forget this password - you'll need it later if you want to view/edit the VBA code!

    Click OK.

    Save the workbook.

    Close and reopen the workbook. You'll find that you cannot view the code if you cannot provide the password.

     

    Warning: this is not 100% tamper-proof. There are ways to disable the password.

Resources