ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run time error '1004' (https://www.excelbanter.com/excel-programming/280968-run-time-error-1004-a.html)

Ikan[_2_]

Run time error '1004'
 
Hi everyone,

I'm new to using excel. I have created a template that includes in it
a macro that sorts customers by their last name. Works fine when I run
it with Sheet unprotected, but when I protect the Sheet an error
message comes out when I ty to run the macro again that reads:

Run time error '1004'
Sort method of Range class failed

Sheet Unprotected

Range("C6:C12").Select
Range("A5:K12").Sort Key1:=Range("C6"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


Sheet Protected ( second line down to last is highlighted)

Range("C6:C12").Select
Range("A5:K12").Sort Key1:=Range("C6"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I would appreciate very much any help regarding how to fix this
problem.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 07:41 PM.

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