ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Protect Worksheet Code Areas (https://www.excelbanter.com/excel-discussion-misc-queries/230122-protect-worksheet-code-areas.html)

Retired Bill

Protect Worksheet Code Areas
 
If I protect a worksheet/workbook from having anyone make changes, does this
automatically protect the worksheet code area/s as well?

Kevin B[_3_]

Protect Worksheet Code Areas
 
I'm assuming by code areas you mean VB modules containing macros. If that's
the case then protection at the level a worksheet or workbook does not have
any effect on your code.

Press Alt + F11 to open the Visual Basic Editor and locate the VBA Project
window. Normally in the upper-left corner. Locate the VBAProject icon that
has your workbook name in parenthesis and right click to open the shortcut
menu.

From the shortcut menu select VBAProject Properties and in the dialog box
that's displayed click the PROTECTION tab.

Click the LOCK PROJECT FOR VIEWING checkbox and add and confirm a password.
Click OK when done, close the Visual Basic Editor and then resave your
workbook.

The code is now password protected.
--
Kevin Backmann
Dallas, TX


"retired bill" wrote:

If I protect a worksheet/workbook from having anyone make changes, does this
automatically protect the worksheet code area/s as well?


Retired Bill

Protect Worksheet Code Areas
 

Kevin, thanks for your input. shall give it a try. Thanks, Bill

"Kevin B" wrote:

I'm assuming by code areas you mean VB modules containing macros. If that's
the case then protection at the level a worksheet or workbook does not have
any effect on your code.

Press Alt + F11 to open the Visual Basic Editor and locate the VBA Project
window. Normally in the upper-left corner. Locate the VBAProject icon that
has your workbook name in parenthesis and right click to open the shortcut
menu.

From the shortcut menu select VBAProject Properties and in the dialog box
that's displayed click the PROTECTION tab.

Click the LOCK PROJECT FOR VIEWING checkbox and add and confirm a password.
Click OK when done, close the Visual Basic Editor and then resave your
workbook.

The code is now password protected.
--
Kevin Backmann
Dallas, TX


"retired bill" wrote:

If I protect a worksheet/workbook from having anyone make changes, does this
automatically protect the worksheet code area/s as well?


Peter T

Protect Worksheet Code Areas
 
Just to add, password protected code is notoriously weak, best to consider
as a deterrent against the casual user tampering with your code but no more.

For code in a worksheet module password protection is virtually
non-existent. All you need to do is copy the sheet to a new workbook and
open the project (might also need select a sheet that doesn't have any code
and copy the pair).

Regards,
Peter T


"Kevin B" wrote in message
...
I'm assuming by code areas you mean VB modules containing macros. If
that's
the case then protection at the level a worksheet or workbook does not
have
any effect on your code.

Press Alt + F11 to open the Visual Basic Editor and locate the VBA Project
window. Normally in the upper-left corner. Locate the VBAProject icon
that
has your workbook name in parenthesis and right click to open the shortcut
menu.

From the shortcut menu select VBAProject Properties and in the dialog box
that's displayed click the PROTECTION tab.

Click the LOCK PROJECT FOR VIEWING checkbox and add and confirm a
password.
Click OK when done, close the Visual Basic Editor and then resave your
workbook.

The code is now password protected.
--
Kevin Backmann
Dallas, TX


"retired bill" wrote:

If I protect a worksheet/workbook from having anyone make changes, does
this
automatically protect the worksheet code area/s as well?





All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com