I'm trying to sort a section in a sheet using two keys. The code looks good but isn't (see below). When stepping through the code, it halts whenever it arrives
at the first .SortFields. line with run time error '48' Named argument not found. Anyone help?
' sort Primary income
Set ws = Worksheets("Primary")
Worksheets("Primary").Activate
lowrow = Range("A" & Rows.Count).End(xlUp).Row
' Range(Cells(5, "A"), Cells(lowrow, "D")).Select
Stop
With ActiveSheet.Sort
.SortFields.Add Key:=Range("C5"), Order1:=xlAscending
.SortFields.Add Key:=Range("A5"), Order1:=xlAscending
.SetRange Range(.Cells(5, "A"), .Cells(lowrow, "D"))
.Header = xlNo
.OrderCustom = 1
.MatchCase = False
.Orientation = x.lTopToBottom
End With
at the first .SortFields. line with run time error '48' Named argument not found. Anyone help?
' sort Primary income
Set ws = Worksheets("Primary")
Worksheets("Primary").Activate
lowrow = Range("A" & Rows.Count).End(xlUp).Row
' Range(Cells(5, "A"), Cells(lowrow, "D")).Select
Stop
With ActiveSheet.Sort
.SortFields.Add Key:=Range("C5"), Order1:=xlAscending
.SortFields.Add Key:=Range("A5"), Order1:=xlAscending
.SetRange Range(.Cells(5, "A"), .Cells(lowrow, "D"))
.Header = xlNo
.OrderCustom = 1
.MatchCase = False
.Orientation = x.lTopToBottom
End With