Solved

Sorting columns in a protected worksheet

Posted on 2013-12-26
2
305 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:
Michael Fowler 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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 demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

622 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