+ Reply to Thread
Results 1 to 3 of 3

Trouble with four key Sort Routine - Excel 2007

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Trouble with four key Sort Routine - Excel 2007

    This remained unsolved from a previous post so I am hoping some guru might pick up on it and solve it.

    I have the sort routing below and despite the fact that I am using Excel 2007 the VBA fails on Key4 with "Compile Error: Named Argument not found"


    Please Login or Register  to view this content.
    At present I am forced to use the rather long winded Macro generated code and would like to simplify it.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Trouble with four key Sort Routine - Excel 2007

    Hi,

    The Range.Sort method only accepts 3 keys. This is the same in XL 2007 as previous versions, hence why you get that compile error message.

    However, in Excel 2007, a new Sort object was introduced. This is what you need to use instead (don't confuse it with the Range.Sort method you are currently using).
    Have a look at the 'Sort Object' topic in your VBA helpfile for further information.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    03-03-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: Trouble with four key Sort Routine - Excel 2007

    Thanks, that explains everything and of course is very similar to the macro built code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1