Hi
I am using this macro (which I found on this site) and it is working a treat - my problem is that on my worksheet I have numerous unlocked cells & users want to be able to Sort & Filter on these columns.
Although I have allowed that, it doesn't work.
When you use the sort ascending buttons etc, it tells you that you can't as the sheet is protected.
I don't want users to know the password (otherwise what would be the point of puting one one)
I see from searching online that this seems to be a glitch in Excel 2010 - ANy ideas as to how I an get round this?
Thanks
Sub PasswordProtectALL()
'
' PasswordProtectALL Macro
' Password protect ALL sheets in workbook Allow formatting of columns, rows, filtering & sorting
'
Dim S As Object
Dim pWord1 As String, pWord2 As String
pWord1 = "secret"
If pWord1 = "" Then Exit Sub
pWord2 = "secret"
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, AllowFormattingRows:=True, AllowFiltering:=True, AllowSorting:=True
Next
MsgBox "All sheets Protected."
Exit Sub
End Sub
Sub PasswordUNProtectALL()
'
' PasswordUNProtectALL Macro
' Remove password protection of ALL worksheets in workbook
'
Dim S As Object
Dim pWord3 As String
pWord3 = "secret"
If pWord3 = "" Then Exit Sub
For Each ws In Worksheets
On Error GoTo errorTrap1
ws.Unprotect Password:=pWord3
Next
MsgBox "All sheets UnProtected."
Exit Sub
errorTrap1:
MsgBox "Sheets could not be UnProtected - Password Incorrect"
Exit Sub
End Sub
Bookmarks