View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Donna Brooks Donna Brooks is offline
external usenet poster
 
Posts: 5
Default Sorting with worksheet protected

I need to be able to sort my data, but my worksheet is
protected. I know that with the Protect method, you can
use "AllowSorting", but all the cells in the sheet must
be unlocked. I'm trying to put Sort Acs & Sort Desc
buttons on my worksheet. This is the code in the
Ascending.
ActiveCell.Range("A1:AW104").Sort Key1:=ActiveCell.Offset
(0, 0).Range("A1"), _
Order1:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom,
DataOption1:=xlSortNormal

But using this code, it sorts the correct column (the
column the cursor is in), but it starts the sort at the
row your cursor is on and that messes the data up. If you
have a fix, please tell me what it is, or is there a way
to just unlock right before sorting.

Thanks in advance,
Donna Brooks