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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,214,780
Messages
6,121,527
Members
449,037
Latest member
tmmotairi

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