ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Trouble with sorting and Worksheet protect (https://www.excelbanter.com/excel-discussion-misc-queries/127307-trouble-sorting-worksheet-protect.html)

Eileen

Trouble with sorting and Worksheet protect
 
I'm clicking on the option to allow sorting by all users and then protecting
the worksheet but when I protect the worksheet and then try to sort, I'm
getting a message that I can't sort without unprotecting the worksheet.

Gord Dibben

Trouble with sorting and Worksheet protect
 
Eileen

You can sort only on unlocked cells in a protected worksheet.

e.g. Unlock cells A1:C10 then protect the sheet.

Select A1:C10 and DataSort


Gord Dibben MS Excel MVP

On Tue, 23 Jan 2007 08:33:01 -0800, Eileen
wrote:

I'm clicking on the option to allow sorting by all users and then protecting
the worksheet but when I protect the worksheet and then try to sort, I'm
getting a message that I can't sort without unprotecting the worksheet.



Eileen

Trouble with sorting and Worksheet protect
 
Thank you for your answer, Gord. But then won't the users be able to change
the values in those cells? That's what I'm trying to avoid. Will the "allow
users to edit ranges" in the protection menu help in any way?

"Gord Dibben" wrote:

Eileen

You can sort only on unlocked cells in a protected worksheet.

e.g. Unlock cells A1:C10 then protect the sheet.

Select A1:C10 and DataSort


Gord Dibben MS Excel MVP

On Tue, 23 Jan 2007 08:33:01 -0800, Eileen
wrote:

I'm clicking on the option to allow sorting by all users and then protecting
the worksheet but when I protect the worksheet and then try to sort, I'm
getting a message that I can't sort without unprotecting the worksheet.




Gord Dibben

Trouble with sorting and Worksheet protect
 
Eileen.

Yes, the users will be able to change those cells that are unlocked.

I don't think "allow users to edit ranges" will help.

The best method to sort on a protected worksheet is to use a macro that
Unprotects, sorts then re-protects the sheet.

Example code..............

Sub Sort_Stuff()
ActiveSheet.Unprotect Password:="justme"
Columns("A:F").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveSheet.Protect Password:="justme"
End Sub


Gord

On Wed, 24 Jan 2007 06:33:05 -0800, Eileen
wrote:

Thank you for your answer, Gord. But then won't the users be able to change
the values in those cells? That's what I'm trying to avoid. Will the "allow
users to edit ranges" in the protection menu help in any way?

"Gord Dibben" wrote:

Eileen

You can sort only on unlocked cells in a protected worksheet.

e.g. Unlock cells A1:C10 then protect the sheet.

Select A1:C10 and DataSort


Gord Dibben MS Excel MVP

On Tue, 23 Jan 2007 08:33:01 -0800, Eileen
wrote:

I'm clicking on the option to allow sorting by all users and then protecting
the worksheet but when I protect the worksheet and then try to sort, I'm
getting a message that I can't sort without unprotecting the worksheet.






All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com