This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub protect_all_sheets() | |
top: | |
pass = InputBox("password?") | |
repass = InputBox("Verify Password") | |
If Not (pass = repass) Then | |
MsgBox "you made a boo boo" | |
Goto top | |
End If | |
For i = 1 To Worksheets.Count | |
If Worksheets(i).ProtectContents = True Then Goto oops | |
Next | |
For Each s In ActiveWorkbook.Worksheets | |
s.Protect Password:=pass | |
Next | |
Exit Sub | |
oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets then running this Macro." | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment