I am running a vba Macro to sort by two columns. First by column "a", then by column "n".The macro seems to do what i want but every time i open it i get the following error
This is the vba code i'm using.Hope someone can help
VBA Code:
Sub Auto_Close()
ActiveSheet.Sort.SortFields.Add2 Key:=Range("A2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add2 Key:=Range("N2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("A:Q")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Last edited by a moderator: