I thought this was simple but something about the sort method is not working. What do I need to do ? Im stumped.
The error is highlighted on
ActiveWorkbook.Worksheets("Sheet1").SortFields.Add Key:=Range( _
"I1:I5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
Below is my macro
Thanks !
===================================
TheConDiscConf = InputBox("Please enter code number")
ActiveSheet.Name = "Sheet1"
Cells.Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$U$5000").AutoFilter Field:=10, Criteria1:= _
"<>" & TheConDiscConf, Operator:=xlAnd
Selection.Delete Shift:=xlUp
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").SortFields.Add Key:=Range( _
"I1:I5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range( _
"F1:F5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:U5000")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With