
Place the bulk of any such code in a standard module and call on it from the worksheet. Now go to Developer tab > Visual Basic > Tools > VBA Project Properties > Protection tab, make sure that you put a tick next to Lock project. Use the VBA Editor to change the access level.

The workaround for this problem involves 2 steps:įile > Info > Protect Workbook > Protect Workbook Structure or Thus, the code embedded in the newly copied worksheet will be visible, even if the source VBA project was password locked or custom protected as unviewable or Unviewable+! Unfortunately, the properties of the source VBA project, including its password, cannot be transferred to the target workbook. The new workbook has its own VBA project, which is unlocked at the time of creation. Copy the worksheet with the event code to a new workbook.Lock the VBA project with a password (VBE > Tools > VBAProject Properties > Protection).

VBA code stored in worksheets (document modules) can be read from workbooks with unprotected structure (Review > Protect Workbook), even if the VBA project is password locked or unviewable. This hack can be demonstrated with the following simple steps:
