We help IT Professionals succeed at work.

How to lock a macro

IbDyhr
IbDyhr used Ask the Experts™
on
How can I lock vba code, so users of the spreadsheet cannot alter it? (Without locking the whole sheet)

Cheers,
Ib
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Awarded 2010
Commented:
Hello,

Right-click the VBA project in the navigation pane of the VB Editor and select Project Properties. On the Protection tab tick "Lock Project for viewing" and enter a password, if desired. Click OK.

Click the Save Icon in the VBE. Save and close your workbook. Open it again and you will now only see the code if you supply the password.

This is not perfect security and easily cracked by people with mal intent, though.

cheers, teylyn

Author

Commented:
Thank you very much!

Author

Commented:
Although I actually DO see the code - but it is read-only.