I have the following code to protect all the sheets in my workbook with a password:
_________________________________________________________________________________
Sub ProtectAll()
Dim S As Object
Dim pWord1 As String, pWord2 As String
pWord1 = InputBox("Please Enter the Password")
If pWord1 = "" Then Exit Sub
pWord2 = InputBox("Please Enter the Password")
If pWord2 = "" Then Exit Sub
'make certain passwords are identical
If InStr(1, pWord2, pWord1, 0) = 0 Or _
InStr(1, pWord1, pWord2, 0) = 0 Then
MsgBox "You entered different passwords. No action taken"
Exit Sub
End If
For Each ws In Worksheets
ws.Protect Password:=pWord1, AllowFormattingColumns:=True
Next
Exit Sub
End Sub
_________________________________________________________________________________
It works great, but I have 1 tiny probem: there is 1 worksheet, named "Trades" that needs to be protected, but without a password. How can I add that to the above code?
Bookmarks