A
Andyjim
I have a macro that moves data from one sheet to another. It is necessary to
unprotect sheets during the data move, then re-protect them after. I protect
the sheets manually before running the macro, using the same password the
macro uses. But after the macro has run, I find I can unprotect the sheet by
hitting Tools>Protection>Unprotect sheet, and it does not ask for a password;
it goes ahead and unprotects the sheet. Prior to running the macro, it does
ask for the password before unprotecting the sheet. The macro definitely is
reprotecting with the same password. Need to solve this to protect formula
cells in one sheet, and data in the other. I've also tried not protecting
them manually at all, just letting the macro do it. Same result.
This is what I'm using in the macro:
ActiveSheet.Protect Password:="XXXXX"
ActiveSheet.Unprotect Password:="XXXXX"
unprotect sheets during the data move, then re-protect them after. I protect
the sheets manually before running the macro, using the same password the
macro uses. But after the macro has run, I find I can unprotect the sheet by
hitting Tools>Protection>Unprotect sheet, and it does not ask for a password;
it goes ahead and unprotects the sheet. Prior to running the macro, it does
ask for the password before unprotecting the sheet. The macro definitely is
reprotecting with the same password. Need to solve this to protect formula
cells in one sheet, and data in the other. I've also tried not protecting
them manually at all, just letting the macro do it. Same result.
This is what I'm using in the macro:
ActiveSheet.Protect Password:="XXXXX"
ActiveSheet.Unprotect Password:="XXXXX"