Hi, I am running the below code aiming to protect all worksheets while allowing for Group/Ungroup to work. The code works as intended but I would also like to be able to perform the below while the workbook/worksheet is password protected:
a. Allow filtering
b. Not allow 'Sort Smallest to Largest'
c. Not allow 'Sort Largest to Smallest'
Can anyone help with the change/s needed in the below code to also account for items a, b and c above?
Thank you very much in advance for your help.
------------------------------------------------------------------------------------------------------------------------------------
Sub ProtectAllWorksheets()
Dim ws As Worksheet
If ActiveWorkbook.Name = "[NAME]" Then
ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="[PASSWORD]", UserInterfaceOnly:=True
ws.EnableOutlining = True
Next ws
ScreenUpdating = True
Else
End If
End Sub
a. Allow filtering
b. Not allow 'Sort Smallest to Largest'
c. Not allow 'Sort Largest to Smallest'
Can anyone help with the change/s needed in the below code to also account for items a, b and c above?
Thank you very much in advance for your help.
------------------------------------------------------------------------------------------------------------------------------------
Sub ProtectAllWorksheets()
Dim ws As Worksheet
If ActiveWorkbook.Name = "[NAME]" Then
ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="[PASSWORD]", UserInterfaceOnly:=True
ws.EnableOutlining = True
Next ws
ScreenUpdating = True
Else
End If
End Sub