Hi Robert
Try these two:
Sub UnProtectAll()
'Macro to Unprotect ALL worksheets
'Written by OzGrid Business Applications
'www.ozgrid.com
Dim SPassWord As String
Dim WSht As Worksheet
SPassWord = ""
SPassWord = InputBox("Password", "Unprotect all sheets")
If SPassWord = "" Then Exit Sub
On Error GoTo WrongPassword
For Each WSht In ActiveWorkbook.Worksheets
WSht.Unprotect Password = SPassWord
Next WSht
SPassWord = ""
Set WSht = Nothing
Exit Sub
WrongPassword:
MsgBox "Wrong password", vbCritical
Set WSht = Nothing
End Sub
Sub ProtectAll()
'Macro to Protect ALL worksheets
'Written by OzGrid Business Applications
'www.ozgrid.com
Dim SPassWord1 As String, SPassWord2 As String
Dim WSht As Worksheet
SPassWord1 = ""
SPassWord2 = ""
SPassWord1 = InputBox("Password", "Protect all sheets")
If SPassWord1 = "" Then Exit Sub
SPassWord2 = InputBox("Retype Password", "Protect all sheets")
If SPassWord2 = "" Then Exit Sub
If SPassWord2 <> SPassWord1 Then
MsgBox "Passwords do not match", vbCritical
SPassWord1 = ""
SPassWord2 = ""
Run "ProtectAll"
End If
On Error Resume Next
For Each WSht In ActiveWorkbook.Worksheets
WSht.Protect Password = SPassWord1
Next WSht
SPassWord1 = ""
SPassWord2 = ""
Set WSht = Nothing
End Sub
Dave
OzGrid Business Applications
On Error GoTo WrongPassword For Each WSht In ActiveWorkbook.Worksheets WSht.Unprotect Password = SPassWord Next WSht SPassWord = "" Set WSht = Nothing Exit Sub
In unprotecting the worksheets. I keep getting a wrong password message when I enter the correct password for all the worksheets. With some modification I can get it to work but I have to enter the same password for each worksheet. What I want to do is enter the password once and it will unprotect all the worksheets with that password.
Hopefully you can help