If your Excel file includes a load of VBA modules and you’re sharing it with other people, or others have access to your network, it is always worth sticking a password on to protect it. Amongst other reasons, this prevents people stealing your hard work and claiming it for themself, or trying to make a tweak and breaking it!
With your Excel workbook open, click Alt + F11 to open the VBA window.
Go to Tools – VBAProject Properties and click on the Protection tab:
Tick the box to ‘Lock project for viewing’ and enter your password:
Simple as that, your code is now protected!