J
Jim K.
I have about a dozen worksheets in a workbook that are password protected. I
want to use a macro to unprotect each sheet (one at a time), lock or unlock
some cells, and then password protect the worksheet before moving to the next
sheet. The password is the same for all the worksheets. I would like the
macro to prompt one time for the password and then use that input to perform
the unprotect and protect. I got the VBA code below when I recorded a macro.
Unfortunately, using this code, the user is prompted each time the worksheet
is unprotected, the cell locks are set, and then the worksheet is protected
again but without the password.
Sheets("Special Loans").Select
ActiveSheet.Unprotect
Cells.Select
Range("M1").Activate
Selection.Locked = True
Selection.FormulaHidden = False
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save
want to use a macro to unprotect each sheet (one at a time), lock or unlock
some cells, and then password protect the worksheet before moving to the next
sheet. The password is the same for all the worksheets. I would like the
macro to prompt one time for the password and then use that input to perform
the unprotect and protect. I got the VBA code below when I recorded a macro.
Unfortunately, using this code, the user is prompted each time the worksheet
is unprotected, the cell locks are set, and then the worksheet is protected
again but without the password.
Sheets("Special Loans").Select
ActiveSheet.Unprotect
Cells.Select
Range("M1").Activate
Selection.Locked = True
Selection.FormulaHidden = False
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save