Results 1 to 8 of 8

Thread: *Resolved* Excel VBA Sort Functions

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Location
    Right here
    Posts
    275

    Resolved *Resolved* Excel VBA Sort Functions

    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:

    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
    Last edited by TheRobster; Apr 27th, 2005 at 08:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width