Excel Vba Password Protect Worksheet Viewing. You can still execute the code by clicking on the command button but you cannot view or edit the code anymore (unless you know the password). If a user hides a sheet using the top menu they can simply unhide it themselves.
Protect Sheet - Allow VBA to Make Changes.
On the Protection tab, check the "Lock project for viewing" option, then type and confirm the password that you want to protect the VBA macros/code from.
To password protect your Excel sheet, type a password in the corresponding field. Protect Current Sheet: This will guard the currently selected worksheet with a password so that people can't make any changes. With the aid of some Excel VBA code placed the private module of the Workbook Object (ThisWorkbook) we can password protect a Worksheet from viewing to all those that do not know the password.





