+ Reply to Thread
Results 1 to 8 of 8

Which part of my autofilter code doesn't work in 2003?

  1. #1
    Registered User
    Join Date
    08-19-2004
    Posts
    60

    Which part of my autofilter code doesn't work in 2003?

    Hi,

    I have a large amount of code which error's when running in Excel 2003. (it does not sort, whereas in 2007 it does).

    As i don't have Excel 2003 can someone tell me which part of my code does not run in Exccel 2003 please:

    Please Login or Register  to view this content.
    Thanks
    Last edited by jamesryan; 03-19-2010 at 05:30 AM. Reason: solved!

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Which part of my autofilter code doesn't work in 2003?

    Everything after the first line - there is no Sort object in 2003. You need to use the range's Sort method - seomthing like:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Which part of my autofilter code doesn't work in 2003?

    To add to romperstomper might be worth adding an If statement using version as a criteria

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-19-2004
    Posts
    60

    Re: Which part of my autofilter code doesn't work in 2003?

    cheers Romper, you're a star.

    Got it sorted now, although very annoying to find more things that don't work in 2003!!

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Which part of my autofilter code doesn't work in 2003?

    That's why it's generally best to develop in the earliest version of Excel that you have to support...

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Which part of my autofilter code doesn't work in 2003?

    romperstomper

    Agreed, I only suggested the If statement because I like the "new" 2007 sort functions!

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Which part of my autofilter code doesn't work in 2003?

    If you are using Option Explicit, the version check still won't work due to the fact that xlSortOnValues does not exist in 2003, so you would have to declare that constant or use the literal value (0) instead.

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Which part of my autofilter code doesn't work in 2003?

    Didn't think of that.

    I didn't check using Option Explicit, I'll remember that!

    Thanks for the tip.

+ 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