Jump to content
groovyPost Forums

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


Abby
Go to solution Solved by Simon H,

Recommended Posts

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

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.
       
      More reading can be found here also on the Outlook OLK folder location:
      http://www.groovypost.com/howto/microsoft/outlook/find-the-microsoft-outlook-temporary-olk-folder/
       
      Thnx!
    • By micalhassey
      I want to best solution for recovering Excel sheet password because I don’t remember my Excel file password please any one suggest me to remove my Excel file password….Thanks
    • By shockersh
      Quick question for you groovy excel ppl out there. I'm working with a vendor and need to calculate the discount and/or increase. I know there is a simple excel formula I can use. Just looking for a tip for it.
      Thanks!
    • By Beyond_Life
      My dad wants me to make him a excel sheet with all different formula's in it. No problem, I can make those. But in the sheet, the first cells are used for a name from his client, and the second cell is used for a date.
      Q: Is it possible to make Excel use those to cells to create the filename of the sheet when it saves?
    • By Truefire
      Outlook 2010 on Windows 7 "download file" box will not go away after i accidentally closed outlook during a file download. Now, every time i open up outlook inbox this file download box opens and attempts to open a file, forcing internet explorer browser to open.
      I really want to resolve this issue, it isn't really annoying and pointless. The file it is attempting to open is no longer contained in any email or in the temporary folders that i am aware of . I have attempted emptying and cleaning temp files, system restore and some other things which have not worked.
      Could you please advise on how i could fix this?
      Thanks, bewildered frustrated, outlook user
      Chris
  • Who's Online   0 Members, 0 Anonymous, 8 Guests (See full list)

    There are no registered users currently online

×
×
  • Create New...