To lock your VBA code in excel click on tools.

Select macro.

Select visual basic editor.

Select your vba project and right click.

Select VBA Project properties.

Click on the protection tab.

Check the box to lock project for viewing.

Enter your password and confirm this password. Click OK and your project is now locked.
