• 1
Abby

How do you allow a table to be sorted in a protected Excel sheet

Question

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?

Excel 2010

Abby

Share this post


Link to post
Share on other sites

2 answers to this question

  • 3

Hi Abby,

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

Sheets("Sheet1").Unprotect Password:="mypassword"

Sheets("Sheet1").Protect Password:="mypassword"

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.

Important

In order to stop people looking at the macro and seeing the password you will need to lock it for viewing, to do this:

  1. Open the Visual Basic editor
  2. Right click on the VBAProject
  3. Choose “VBAProject Properties”
  4. Select the “Protection” tab
  5. Check the “Lock project for viewing” box
  6. Enter your password
  7. Click “OK”

alt text

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

alt text

You can still open the Visual Basic editor but when you click on the project it asks for a password.

alt text

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.

Share this post


Link to post
Share on other sites
  • 0

Hi Abby,

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

Sheets("Sheet1").Unprotect Password:="mypassword"

Sheets("Sheet1").Protect Password:="mypassword"

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.

Important

In order to stop people looking at the macro and seeing the password you will need to lock it for viewing, to do this:

  1. Open the Visual Basic editor
  2. Right click on the VBAProject
  3. Choose “VBAProject Properties”
  4. Select the “Protection” tab
  5. Check the “Lock project for viewing” box
  6. Enter your password
  7. Click “OK”

alt text

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

 

alt text

You can still open the Visual Basic editor but when you click on the project it asks for a password.

alt text

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.

 

thanks Simon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • By Steve
      Question from Reader - Email Form
       
       
      Hi Tom,
       
      Ouch. I know how it feels losing a days worth of work. The worst part is when you have to recreate what you've already done.
       
      To answer your question, when you found the Entry "OutlookSecureTempFolder" what was the path in the DATA column? I assume you reviewed this post here to find it. It looks like you found the registry key entry so your more than 1/2 way there. Find that key again and you should have the path to your OLK folder and your Excel should be sitting there.
       
      Now the path might be a bit confusing because with Outlook 2007, there actually is "NOT" an OLK folder. For instance, on my XP/Outlook 2007 install, my OLK folder or "Temp Outlook Folder" / "OutlookSecureTempFolder" is:
       
      "c:\Documents and Settings\mrgroove\Local Settings\Temporary Internet Files\Content.Outlook\4V32TZLP"
       
      So if you look on your box you will find what your looking for in the "Content.Outlook" folder. Take a look there and your golden.
       
      Let me know how this works for you!
  • Who's Online   0 Members, 1 Anonymous, 20 Guests (See full list)

    There are no registered users currently online