Allow sorting in a protected sheet

Src016

New Member
Joined
May 21, 2019
Messages
10
Hi all,

I need to allow sorting in an unlocked table within a protected sheet. I have enabled filtering, but for some reason sorting is an issue. Every time I try and sort I'm prompted with "The cell or chart you're trying to change is on a protected sheet. To make a change, protect the sheet. You might be requested to enter a password." The code I use to protect the sheet is below. The allow filtering works, but I'm having an issue with the allow sorting. I would like to avoid this, but I could write code that unlocks the entire sheet if the topline of the taple (row 18) is selected. This would allow sorting then re-lock the sheet. Any suggestions would be greatly appreciated!

HTML:
ws.Protect wsSettings.Range("Settings_Password"), AllowFiltering:=True, AllowSorting:=True
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You'll need to remove the password in the VBA code and then sort and then reset the password. Then, save the VBA with a password so that a knowledgeable user can't find the password in the VBA code.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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