ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   How do I sort a proctected worksheet (https://www.excelbanter.com/new-users-excel/99917-how-do-i-sort-proctected-worksheet.html)

Audrey

How do I sort a proctected worksheet
 


Chip Pearson

How do I sort a proctected worksheet
 
Unprotect it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Audrey" wrote in message
...




Audrey

How do I sort a proctected worksheet
 
That is a given, but I have columns that I don't want sorted.

I have locked those columns in hopes they would not sort and the others would.

Any suggestions?

Thanks for the help.

"Chip Pearson" wrote:

Unprotect it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Audrey" wrote in message
...





Dave Peterson

How do I sort a proctected worksheet
 
Be specific about the range to sort--exclude the columns that should not be
sorted from the range to be sorted.

The range to sort must be contiguous, though.

dim wks as worksheet
dim rng as range
set wks = worksheets("Protected")
with wks
.unprotect password:="Hi"
set rng = .range("d3:g" & .cells(.rows.count,"D").end(xlup).row)

with rng
.sort key1:=.columns(3), order1:=xlascending, header:=true
end with
.protect password:="Hi"
end with

===
Untested and uncompiled--watch for typos.

I sorted D3:G (lastrow in column D). and avoided all the other cells.


Audrey wrote:

That is a given, but I have columns that I don't want sorted.

I have locked those columns in hopes they would not sort and the others would.

Any suggestions?

Thanks for the help.

"Chip Pearson" wrote:

Unprotect it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Audrey" wrote in message
...





--

Dave Peterson


All times are GMT +1. The time now is 11:48 PM.

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