MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Password Protecting Worksheets and VB Code

Posted by another Todd on November 13, 2001 10:52 AM

is there a way I can protect VB code from being visible? I want to distribute this spreadsheet, but under no condition are they allowed to see the VB code without the password.
I know how to protect a sheet from being viewed, by setting the visible property to 2 (very hidden). But somebody can go into VB code and change the property to visible. Is there a way to permanently hide a sheet unless the user knows the password?
I have seen the method of protection in the Excel help files, by hiding rows and columns then selection Protect. But, visual basic will not interact with a value on a spreadsheet that is in a hidden row or column, and I need the interaction. So I can't go this route. Plus, I want to hide entire sheets, not portions.
Hopefully I can prevent a person from getting into the VB code and properties, and then can set the visible properties of the sheets I want hidden to 2. So, any ideas?

Posted by another Todd on November 13, 2001 11:06 AM


I figured it out. You can go to your VBA Project properties and there is a password protect window there. It also appears to keep the worksheets very hidden.