![]() |
Sorting a protected worksheet
The obvious choice would be to unprotect and reprotect the worksheet
Activesheet.unprotect Password:="ABCD" Range(Cells(56, 2), Cells(rw, 2)).Select Selection.Sort Key1:=Range("B56"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Activesheet.Protect Password:="ABCD" You can also look at the UserInterfaceOnly property of the Protect method if you are leary about unprotecting the sheet for the sort. -- Regards, Tom Ogilvy "Vince" wrote in message ... I am using the following code to sort, and it works fine as long as the worksheet is not protected. When the worksheet is protected, I get the error 1004 Sort method of range class failed. I have made sure the cells that are being sorted are not protected, but I still get the error after I protect the worksheet. Any help would be appreciated. Range(Cells(56, 2), Cells(rw, 2)).Select Selection.Sort Key1:=Range("B56"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Thank you, Vince |
All times are GMT +1. The time now is 03:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com