TheRobster
Apr 27th, 2005, 01:21 PM
I am testing an Excel app. that was originally written in Excel 2002 and is also supposed to compatible with Excel 2000. However there is a VBA macro that doesn't seem to work in Excel 2000 (though it works fine in 2002).
The code sorts a table of data in descending order, but when I try to run the macro I get the error message:
Run-time error '1004':
Application-defined or object defined error
This is the offending peice of VBA code:
Selection.Sort Key1:=Range("K21"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
The code is supposed to sort the data table but it just produces an error. The code was recorded in Excel 2002 using the Record Macro function and it would appear there is something in there that Excel 2002 can understand but 2000 can't. Excel 2000 has a Sort function though, so I can't see why this doesn't work.
Can anyone see anything in that code which is only available to Excel 2002 or above?
Cheers
-Rob
The code sorts a table of data in descending order, but when I try to run the macro I get the error message:
Run-time error '1004':
Application-defined or object defined error
This is the offending peice of VBA code:
Selection.Sort Key1:=Range("K21"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
The code is supposed to sort the data table but it just produces an error. The code was recorded in Excel 2002 using the Record Macro function and it would appear there is something in there that Excel 2002 can understand but 2000 can't. Excel 2000 has a Sort function though, so I can't see why this doesn't work.
Can anyone see anything in that code which is only available to Excel 2002 or above?
Cheers
-Rob