Solved

Sorting columns in a protected worksheet

Posted on 2013-12-26
2
302 Views
Last Modified: 2013-12-26
I have a worksheet where all cells are protected, however, I would like to allow users to sort.  I have selected the options for allowing 'sorting' and 'auto filer' when setting the password, however, I believe I must also have some kind of code in there as well.

I found the below code somewhere else which I am not sure will work, because I currently have code in there to allow users to group/ungroup on another sheet in the workbook.  If the below code is correct, how would I incorporate this into my existing code as shown on the sample attached?  If the code is incorrect, what would be the correct code and how should it be incorporating into the existing code?  Thanks!

Private Sub Workbook_Open()
For Each ws In ActiveWorkbook.Worksheets


ws.Protect Password:="", AllowSorting:=True

Next
End Sub
sample.xlsm
0
Comment
Question by:daisypetals313
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Michael74 earned 500 total points
ID: 39740967
The problem is bit more complicated than the answer you proposed.

Here is a really good article which includes 2 different solutions to the issue

http://blog.softartisans.com/2013/10/01/kb-sorting-locked-cells-in-protected-worksheets/

Michael
0
 

Author Closing Comment

by:daisypetals313
ID: 39740980
It worked!  I used the Scenario 1 option from the article.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question