Auto filters and locked protected sheet

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
Is ther some way to protect a worsheet so ppl can not write/delete data but still can use the colum filters to sort and search?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Is ther some way to protect a worsheet so ppl can not write/delete data but still can use the colum filters to sort and search?

Under the Review tab, select Protect sheet. From there, check the following boxes:
  • Select Locked Cells
  • Select Unlocked Cells
  • Sort
  • Use AutoFilter

The VBA equivalent is
Code:
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
 
Upvote 0
Ran into an issue, tried to apply a password as well but cant fiond the syntax. can you help?

ActiveSheet.Protect "*** DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
 
Upvote 0
Also I can choose a filter and enter search criteria just finme with this script. But it will not let me sort alphabetically from teh filter.
 
Upvote 0
The quick answer is to record a macro doing exactly what you need to do. The return recording is usually bulky, but it gives you a good direction of how to do filtering, sorting, and viewing from a macro sub. Plus it gives you the benefit of learning some basics of how to handle excel objects from a sub (not called a script)
 
Upvote 0
thanks, that I know and we are past that. not sure you saw the path of the thread....
 
Upvote 0
I worked out the syntax for the macro. So now I only have the issue where I can not sort the protected sheet via the filter. Any ideas?
 
Upvote 0
My mistake I did not correct the syntax. How do I add a password to this?
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
 
Upvote 0

Forum statistics

Threads
1,216,081
Messages
6,128,695
Members
449,464
Latest member
againofsoul

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