VBA Protect Sheet But Still Filter/Sort

SilencioDubueno

New Member
Joined
May 26, 2022
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello All!
I'm currently writing out a sub to protect specific sheets such that they can still be accessed and edited by macros, but people can still go and filter/sort the data tables freely. My understanding is this code should work:

VBA Code:
Worksheets("Sheet1").protect Password:="Jeebus", UserInterfaceonly:=True, AllowSorting:=True, AllowFiltering:=True

The sheet is protected with this and can be edited by macros ald lets people filter, but will not allow people to sort data. When I run the code for another page that has a specific Edit Range, the code states that the macros on it cannot be run. I'm not 100% sure why there is a difference with the same code.

Any help is appreciated.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,792
Messages
6,121,612
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top