I have a protected worksheet but I want users to be able to sort one of the tables.
When protecting the sheet I checked the options allowing users to select cells, sort and use auto filter but it won’t allow the table to be sorted without entering the password for the sheet. What am I doing wrong?
asked Aug 03 '12 at 06:40
You aren’t doing anything wrong. Those checkboxes have never allowed protected cells to be sorted. All they do is make the sort option available on a protected sheet to be used on cells that are unprotected.
You will need to create a macro which unprotects the sheet, sorts your table then re-protects it.
The code to unprotect and protect would be
Where sheet1 is the name of the sheet you are working on and mypassword is the password you used to protect the sheet.
You just need to add the code to do whatever type of sort you want. If you don’t know how to write the macro to do the sort, you could record one and add the code to unprotect / re-protect.
In order to stop people looking at the macro and seeing the password you will need to lock it for viewing, to do this:
To enable the password you will need to Close the VBA editor and save the workbook.
When you re-open the workbook and click the Macros icon all the options for the macro are greyed out apart from Run
You can still open the Visual Basic editor but when you click on the project it asks for a password.
You will need to do a different macro for each type of sort on each column of the table that users will need to perform.
You could also add macro buttons to the sheet and label then with the sort that they will activate.
answered Aug 04 '12 at 11:37