hi below is my macro.. with error reference is not valid. i went though the web but can't find answer that satisfy me. Please help
Range("A8:Q500").Select
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("A9:A500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("Q9:Q500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("C9:C500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A8:Q500").Select
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("A9:A500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("Q9:Q500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields.Add _
Key:=Range("C9:C500"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With