How can I make it so the below macro sets all sheets to password except 1? I would like sheet1 to have the password: password1 and all other to have password.
Any help is welcomed.
Sub ProtectAllLB()
top:
pass = "password"
repass = "password"
If Not (pass = repass) Then
MsgBox "Passwords do not match"
GoTo top
End If
For i = 1 To Worksheets.Count
If Worksheets(i).ProtectContents = True Then GoTo err
Next
For Each s In ActiveWorkbook.Worksheets
s.Protect Password:=pass, UserInterfaceOnly:=True
Next
Run "RemoveToolbars"
ActiveWorkbook.Save
Application.StatusBar = "Dashboard Updated and Saved successfully, Thank you."
MsgBox "Dashboard Save Completed.", vbInformation
Exit Sub
err: MsgBox "Please unprotect all sheets before running this Macro."
End Sub
Any help is welcomed.
Sub ProtectAllLB()
top:
pass = "password"
repass = "password"
If Not (pass = repass) Then
MsgBox "Passwords do not match"
GoTo top
End If
For i = 1 To Worksheets.Count
If Worksheets(i).ProtectContents = True Then GoTo err
Next
For Each s In ActiveWorkbook.Worksheets
s.Protect Password:=pass, UserInterfaceOnly:=True
Next
Run "RemoveToolbars"
ActiveWorkbook.Save
Application.StatusBar = "Dashboard Updated and Saved successfully, Thank you."
MsgBox "Dashboard Save Completed.", vbInformation
Exit Sub
err: MsgBox "Please unprotect all sheets before running this Macro."
End Sub