Sorting in protected worksheets

  • Thread starter Thread starter Kevan
  • Start date Start date
K

Kevan

Using Excel 2000, is there any way to sort data in
unlocked cells on a content protected worksheet? I want
users to be able to change and sort data in several cells
of a worksheet (those I have unlocked), but I have
several cells on the same sheet that contain formulas and
data that must remain unchanged (those I have locked).
 
In case anyone is interested, I figured out a way to do
it. I just created a macro that unprotected the sheet,
sorted desired cells, then reprotected the sheet. It is
only practical if there is no password though. If anyone
knows a better way, please let me know.
 
You can include the password in the code:

Sub SortProtect()
ActiveSheet.Unprotect Password:="hello"
Range("A1:A17").Sort Key1:=Range("A1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, _
Password:="hello"
End Sub
 
Back
Top