If you have an EXCEL workbook that includes some VBA code, and you want to hide that code, either to protect your intellectual property or simply to prevent others from messing up your code accidently , then follow these steps:
1. In the Developer tab, Code group, click Visual Basic. This will switch you to VBA development environment.
2. Create your project with the required code.
3. In the VBA development environment, click on the Tools menu and select VBAProject Properties.
The Project Properties window will open.
4. Select the Protection tab.
5. Select the checkbox Lock project for viewing.
6. Enter Password and Confirm password.
7. Click OK.
8. Save the workbook and then close it so that the password protection takes effect. Next time you open the workbook and try to view the code you will be prompted for the password.














