Password Protect Excel VBA Macros
How to password protect VBA code and macros in Excel so that a user cannot see the code or edit it or do anything to it at all.
This allows you to safely secure your VBA code and prevent users from tampering with it or even seeing it.
Steps to Password Protect VBA Code/Macros
- Go to the VBA Editor window by hitting Alt + F11
- Right-click the desired project from the left side of the window and then click VBAProject Properties...
OR go to Tools > VBAProject Properties... - In the window that opens, go to the Protection tab and check next to where it says Lock project for viewing and then enter a password.
- Hit OK, save the file, close it, and that's it!
Now, whenever you go to open the file and view the code again, the window will look like this:
And, when you try to expand the project, a window opens for you to enter the password.
You now can't do anything with this project unless you have the password for it.
Notes
DO NOT LOSE YOUR PASSWORD!
DO NOT ASK US FOR HELP OPENING A PASSWORD PROTECTED FILE OR PROJECT!
Download the sample file to see this feature in action; the password for this is 123456 (PLEASE don't ever use that as a real password for anything, this was done here just to keep things simple for you).