Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Sorting with worksheet protected

I'm not sure that this is the best way to do it, but what
I did to get around this is pretty simple.

At the point you want protection off put in:

activesheet.unprotect

and where you want it reprotected (you guessed it):

activesheet.protect

Hope this helps.

KG
-----Original Message-----
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
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting a Protected Worksheet Shannon Excel Discussion (Misc queries) 1 September 25th 07 01:11 AM
Sorting Protected Worksheet Marge Excel Worksheet Functions 4 April 26th 07 04:56 PM
Sorting Protected Worksheet Vonner Excel Discussion (Misc queries) 1 July 16th 05 03:23 PM
Sorting on a protected worksheet Sue Excel Discussion (Misc queries) 6 June 12th 05 09:26 AM
Sorting protected worksheet Phyllis Excel Discussion (Misc queries) 3 December 15th 04 11:27 PM


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"