indi visual
Member
I've had this problem for a while now.
Been looking for a way to make this recorded macro of the auto filter much shorter.
I'm sure all of this isn't necessary if I only wish to sort in ascending order.
Also, to define the range on the sorter (when the range is not known).
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Add Key:=Range( _
"A2:A44"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets(1).AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Been looking for a way to make this recorded macro of the auto filter much shorter.
I'm sure all of this isn't necessary if I only wish to sort in ascending order.
Also, to define the range on the sorter (when the range is not known).
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Add Key:=Range( _
"A2:A44"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets(1).AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With