Hi All, I have the following macro working in Excel 2007 but it appears not to be compatible with 2003:
Sub VT_Filter()
Sheets("Dashboard").Calculate
Dim ws As Worksheet
Dim Str_Ce1, Str_Ce2 As String
Dim Byt_j As Byte
Set ws = Sheets("CHART DATA")
With ws
.Range("$A$8:$T$305").AutoFilter
For Byt_j = 1 To 4
Str_Ce1 = Choose(Byt_j, "9", "52", "123", "208")
Str_Ce2 = Choose(Byt_j, "50", "121", "206", "305")
ws.Sort.SortFields.Clear
ws.Sort.SortFields.Add Key:=Range("B" & Str_Ce1 & ":B" & Str_Ce2), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
'SORT BY PCT
ws.Sort.SortFields.Add Key:=Range("E" & Str_Ce1 & ":E" & Str_Ce2), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
'THEN SORT BY QUALIFIER
With ws.Sort
.SetRange Range("A" & Str_Ce1 & ":T" & Str_Ce2)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next Byt_j
With .Range("$A$8:$T$305")
.AutoFilter 2, "<>False"
.AutoFilter 7, "<>False"
End With
End With
End Sub
It's the <ws.Sort.SortFields.Clear> function that appears to be the problem. Can anyone help me to code this so that it's compatible with 2003?
Many thanks,
AdLoki
Bookmarks