+ Reply to Thread
Results 1 to 3 of 3

Converting Macro that sorted table in 2007 to Excel 2003

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2010
    Posts
    68

    Converting Macro that sorted table in 2007 to Excel 2003

    I have a spreadsheet that has multiple tables in the same page that was created in excel 2007. I have users that still use 2003, so i need to basically build from scratch to accomodate.

    Each table had a button assigned to it that sorted on a given row. the code looked like this:

    Please Login or Register  to view this content.
    I've come to realize Excel 2003 uses something called "Lists" rather than tables. So I used the macro recorder and sorted the "List" and came up with this code:

    Please Login or Register  to view this content.
    This works fine except as soon it only works on the original range c7:29. These tables/or lists can move up or down rows, and have rows inserted which renders this useless.

    Any help is appreciated.

    thanks!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Converting Macro that sorted table in 2007 to Excel 2003

    Hi, MaddyG,

    maybe you try an alteration for the range with CurrentRegion as that would refer to any range directly "connected" to that cell:

    Please Login or Register  to view this content.
    Or you get the number of the last used and visible cell in Column C and use that for your range:
    Please Login or Register  to view this content.
    I´m not a friend of Select or Activate as they mostly prove to be unnecessary.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-15-2012
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Converting Macro that sorted table in 2007 to Excel 2003

    Thanks for the ideas Holger! Both however yield a compile error. It didn't seem to recognize "CurrentRegion", and the second option the whole thing is highlighted red.

    Attaching a sample copy if that helps.
    Attached Files Attached Files

+ 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