R
Richard Clarke
Hi
I am performing a sort programatically in Excel 2002 on Windows XP
The line of code to sort is as follows:
Range(Cells(15, 1), Cells(endrow,
Range("iNonQualStatus").Column)).Sort Key1:=Range("iItemType"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=ordercustomnumber, MatchCase:=False,
Orientation:=xlTopToBottom
This throws the following error:
Sort Method of Range class failed
The sheet is protected both programatically and using Excel's protect
option from the menus.
No matter what I try regarding setting different protections at
run-time or saving the sheet with different protections, whenever I
hit the line of code above, the allowsorting propery is false.
In order to test sorting I created a new workbook and sheet to test
the sorting functionality and even this fails - with no protections,
and allowsorting reporting true when interrogated at runtime (although
this time the error is 1004 Application-defined or object-defined
error).
Can anyone suggest why this doesn't work in either scenario?
Many thanks
I am performing a sort programatically in Excel 2002 on Windows XP
The line of code to sort is as follows:
Range(Cells(15, 1), Cells(endrow,
Range("iNonQualStatus").Column)).Sort Key1:=Range("iItemType"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=ordercustomnumber, MatchCase:=False,
Orientation:=xlTopToBottom
This throws the following error:
Sort Method of Range class failed
The sheet is protected both programatically and using Excel's protect
option from the menus.
No matter what I try regarding setting different protections at
run-time or saving the sheet with different protections, whenever I
hit the line of code above, the allowsorting propery is false.
In order to test sorting I created a new workbook and sheet to test
the sorting functionality and even this fails - with no protections,
and allowsorting reporting true when interrogated at runtime (although
this time the error is 1004 Application-defined or object-defined
error).
Can anyone suggest why this doesn't work in either scenario?
Many thanks