Hi All,
I am using this quick macro below to lock all sheets in the workbook with the same password. However, I also want to ensure every sheet has .AllowFormattingRows to be true. For some reason, whenever I run the macro, it locks the sheet fine, but always sets the AllowFormattingRows to false, even if it was true to start with.
Any ideas please?
Dim myWS As Worksheet
Dim myPW As String
myPW = InputBox("Enter Password", "Protect All")
If myPW > "" Then
For Each myWS In Worksheets
myWS.Select
If myWS.Protection.AllowFormattingRows = False Then
myWS.Protect AllowFormattingRows = True
End If
If myWS.Protection.AllowFormattingRows = True Then
myWS.Protect AllowFormattingRows = True
End If
myWS.Protect Password:=myPW
Next myWS
End If
Bookmarks