+ Reply to Thread
Results 1 to 2 of 2

2010 to 2003 Macro Coversion

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    2010 to 2003 Macro Coversion

    I recorded some code using Excel 2010 and would like that same code to work in both Excel 2003 and 2010 (see code below). I currently get an error when I run this code in 2003 but not 2010. I know recording is not best practice but can someone help me convert what seems to be a pretty simple "sort a range type of code".

    Thanks,

    D

    Application.Goto Reference:="mainsort"
        ActiveWorkbook.Worksheets("Sum").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Sum").Sort.SortFields.Add Key:=Range("B7:B57"), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Sum").Sort
            .SetRange Range("A6:J57")
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    ______________________________________
    "Vision without Execution is a Hallucination"
    Edison

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: 2010 to 2003 Macro Coversion

    perhaps
    Application.Goto Reference:="mainsort"
    With ActiveWorkbook.Worksheets("Sum")
        .Range("A6:J57").Sort Key1:=.Range("B7"), Order1:=xlDescending, DataOption1:=xlSortNormal
    End With
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ 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