Results 1 to 5 of 5

VBA in 2007 v 2003

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    VBA in 2007 v 2003

    Can anyone advise me why the line

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

    from the code below works fine in Exccel 2007 but falls over in 2003, and is there a workaround?


    'Filter Relevant to Top...
        Range("A9:C" & LastTransRow).Select
        ActiveWorkbook.Worksheets(CurrentWorksheet).Sort.SortFields.Clear
        ActiveWorkbook.Worksheets(CurrentWorksheet).Sort.SortFields.Add Key:=Range("A8"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        With ActiveWorkbook.Worksheets(CurrentWorksheet).Sort
          .SetRange Range("A9:C" & LastExtractRow)
          .Header = xlNo
          .MatchCase = False
          .Orientation = xlTopToBottom
          .SortMethod = xlPinYin
          .Apply
        End With
    Thanks for any help
    Last edited by rylo; 01-16-2009 at 02:53 AM. Reason: add code tags

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