How to protect VBA code in Excel (windows & mac)

It would have happened many times we have created a VBA code and we wish to protect or lock from accessing by someone the code in order to avoid changes, Well we have the solution for it were can Lock/Protect the VBA Project by giving a password for windows & mac users.

Excel Windows users

Go to Developer Tab > click Visual Basic or Press Alt + F11 keys to open Microsoft Visual Basic for Applications window.

Open VBA Editor

  • From the menu bar select Tools > VBAProject Properties
  • A pop-up window will open “Project Properties
  • Select the “Protection Tab
  • Check the box “Lock Project For Viewing
  • Set your password & Save the project
Lock VBA Code

Close the VBA Editor and make sure to save the file as Excel Macro-Enabled Workbook to make the above steps work


When next time you try to access the module it is denied. Only users with the password can access it.

unlock VBA Code

Excel Mac users

Go to Developer Tab > click Visual Basic or Press opt + F11 keys to open Microsoft Visual Basic for Applications window.

Open VBA Editor macOS

  • From the menu bar select Tools > VBAProject Properties
  • The pop-up window will open “Project Properties
  • Select the “Protection Tab
  • Check the box “Lock Project For Viewing
  • Set your password & Save the project
Lock VBA Code macOS

Close the VBA Editor and make sure to save the file as Excel Macro-Enabled Workbook to make the above steps work


When next time you try to access the module it is denied. The only users with the password can access it.

unlock VBA Code macOS

Was the information helpful in this blog?

  • If yes, hit that share button and show the excitement to the world.
  • Subscribe to our free posts.

Join 2,923 other subscribers
  • If no, please let us know what to improve.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x