Hi All,
I need help. I am using the following codes first to protect all worksheets and then I run the code to unprotect all sheets to make some corrections.
When I run the Unprotect code after all worksheets have been protected, I am getting Run-time Error 1004 (all as hereunder.
I know I am missing something. Would anyone know what this something is please?
Thanks for help
paraxis
' Macro to protect multiple sheets
Option Explicit
Sub protectSheets()
Dim i As Long
For i = 1 To Sheets.Count
Sheets(i).protect Password:="123"
Next i
End Sub
' Macro to unprotect multiple sheets
Sub UnProtectSheets()
Dim i As Long
For i = 1 To Sheets.Count
Sheets(i).Unprotect Password:="123"
Next i
End Sub
Giving error
Run-time Error '1004'
The password you supplied is not correct. Verify that the CAPS LOCK key is off
and be sure to use the correct capitalisation.
Bookmarks