ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Protection doesn't hold (https://www.excelbanter.com/excel-programming/403658-sheet-protection-doesnt-hold.html)

Andyjim

Sheet Protection doesn't hold
 
I have to unprotect sheets during a macro, move some data, then reprotect.
I'm using an 8 character password. Before running the macro,
ToolsProtectionUnprotect sheet prompts for the password. But after running
the macro (and remember the macro does reprotect with the 8 character
password), it is protected, but ToolsProtectionUnprotect sheet unprotects
it without requiring a password.

I need the formulas and macro code to be inaccessible to users. Is there
some syntax I need to add to make this happen? It seems like the
protect/unprotect in VBA is somehow separate from the protect/unprotect in
the workbook itself. Here's what I'm using:

ActiveSheet.Unprotect Password:="xxxxxxxx"

'data manipulations

ActiveSheet.Protect Password:="xxxxxxxx", DrawingObjects:=True,
Contents:=True, Scenarios:=True


All times are GMT +1. The time now is 11:18 AM.

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