Tutorial Details
Downloadable Files: Excel File
Introduction to Programming Macros in Excel
First Steps
Getting and Inputting Data
Adding Logic to Macros
Loops
UDF- User Defined Functions
Speeding Up Macros
Security

Password Protect Excel VBA Macros

Add to Favorites
Author:

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

  1. Go to the VBA Editor window by hitting Alt  + F11
    d42e890b8c8c6e19fadbf32259244996.jpg
  2. Right-click the desired project from the left side of the window and then click VBAProject Properties...
    85f6053a876780a18aebdaec80d33c75.jpg
    OR go to Tools > VBAProject Properties...
    c5e379bc9e080ae0760f1c35681dfe9b.jpg
  3. 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.
    258ba4afef16a57eec223241d44a13e5.png
  4. 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:

83ebe49f2de6f3fde70fa9f38fabac85.jpg

And, when you try to expand the project, a window opens for you to enter the password.

68e996e3e7f3531105c1e81209aef374.png

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).

Question? Ask it in our Excel Forum


Downloadable Files: Excel File