Solved

Sorting columns in a protected worksheet

Posted on 2013-12-26
2
270 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now