Hi,
I've written some VBA that works in 2007 and 2010, but it doesn't work in 2003.
Here's the code:
Sheet6.Sort.SortFields.Clear
It highlights '.Sort' and says:
"Compile Error: Method or data member not found"
Is there another way of doing sorting in Excel 2003?
Here's my entire sorting function that will likely need a few touch-ups:
Public Sub SortByCode(column As Integer)
Dim columnString As String
Sheet6.Sort.SortFields.Clear
Select Case column
Case 1
columnString = "A2:A"
Case 2
columnString = "B2:B"
Case 3
columnString = "C2:C"
Case 4
columnString = "D2:D"
End Select
Sheet6.Sort.SortFields.Add Key:=Range(columnString & countOfResults + 1), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With Sheet6.Sort
.SetRange Range("A1:E" & countOfResults + 1)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks