+ Reply to Thread
Results 1 to 9 of 9

How to convert macros in Excel

  1. #1
    Registered User
    Join Date
    02-15-2012
    Location
    Lynnwood, WA, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    How to convert macros in Excel

    Hello,

    I have an Excel 2010 spreadsheet with some macros. Many users in our organization are still using Excel 2003, so I'm saving this spreadsheet in the older version, xls.

    However, the macros created in Excel 2010 don't work in Excel 2003. This is just one example - the execution breaks here:

    ActiveWorkbook.Worksheets("Sort").Sort.SortFields.Clear

    with the message:

    Object doesn't support this property or method (Error 438)

    Is there a way to convert Excel 2010 macros to 2003 version?

    Thank you.
    Last edited by pva; 02-16-2012 at 01:05 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to convert macros in Excel

    There is no conversion tool that I am aware of. Generally you are better off creating the code in the oldest version you have to support. Here the specific issue is that the Sort object did not exist pre-2007 so you have to use the Range.Sort method instead.
    Good luck.

  3. #3
    Registered User
    Join Date
    02-15-2012
    Location
    Lynnwood, WA, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to convert macros in Excel

    Thank you.

    How would I use Range.Sort to apply it to the whole worksheet? I'm not an expert in VBA.

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to convert macros in Excel

    What are you sorting on? Roughly speaking it would be:
    Please Login or Register  to view this content.
    for example

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: How to convert macros in Excel

    The following could be used (I think) in a 2010 workbook, 2007 workbook, and a 2003 workbook but you'll need to find the code for sorting accordingly to the version.
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  6. #6
    Registered User
    Join Date
    02-15-2012
    Location
    Lynnwood, WA, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to convert macros in Excel

    Sorry, I've just signed up.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to convert macros in Excel

    I think that is simply:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-15-2012
    Location
    Lynnwood, WA, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to convert macros in Excel

    Thank you, this seems to work.

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to convert macros in Excel

    Glad to help. Please don't forget to mark the thread Solved (see FAQ link at top of page for instructions).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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