We are in the process of updating the site, so some pages still have the older design.

Password Protect Excel VBA Macros

Download Project Files
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).

Download the Project Files

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use

Downloadable Files: Project File

Download Project File

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Login to a Website using a Macro
: Connect and login to a website using a macro in Excel. This allows you to open a website a...
Password Protect Excel Files
Tutorial: How to keep an Excel workbook safe by encrypting it with a password. This will make it so ...
Loop through a Range of Cells in Excel VBA/Macros
Tutorial: How to use VBA/Macros to iterate through each cell in a range, either a row, a column, or ...
Logical Operators in Excel VBA Macros
Tutorial: Logical operators in VBA allow you to make decisions when certain conditions are met. They...
How to Add a New Line to a Message Box (MsgBox) in Excel VBA Macros
Tutorial: I'll show you how to create a message box popup window in Excel that contains text on mult...
Next Empty Row Trick in Excel VBA & Macros
Tutorial: A simple way to find the next completely empty row in Excel using VBA/Macros, even if som...
Tutorial Details
Downloadable Files: Project File

Download Project File

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course