I created a code to automatically protect multiple sheets in a workbook with a password of my choice but without having to manually enter it. Let's pretend the password = ORANGE. See code below:
I currently have a code to unprotect it by automatically entering the password (ORANGE)...works great! However, I do not want anyone to automatically unprotecting these sheets. Just those that have the password. I would like to Unprotect these tabs by:
Any help is appreciated.
Sub ProtectTabs()
Dim ws As Worksheet
Set WSArray = Sheets(Array("Sheet1", "Sheet3", "Sheet5"))
For Each ws In WSArray
ws.Protect password:="ORANGE", DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub
Dim ws As Worksheet
Set WSArray = Sheets(Array("Sheet1", "Sheet3", "Sheet5"))
For Each ws In WSArray
ws.Protect password:="ORANGE", DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub
I currently have a code to unprotect it by automatically entering the password (ORANGE)...works great! However, I do not want anyone to automatically unprotecting these sheets. Just those that have the password. I would like to Unprotect these tabs by:
1) having the user enter the correct password (ORANGE) once to unlock all sheets in array
2) If p/w is incorrect having msg "Incorrect Password, Try again" and looping them back to the p/w input
3) Looping a max of 3 times, if unsuccessful then Msg. "See Administrator for help"
2) If p/w is incorrect having msg "Incorrect Password, Try again" and looping them back to the p/w input
3) Looping a max of 3 times, if unsuccessful then Msg. "See Administrator for help"
Any help is appreciated.