Answers for "excel vba auto sort multiple columns"

VBA
0

vba sort multiple columns

' Sorts a range with multiple criterias
Sub MultipleColumnsSort()
    With ActiveSheet.Sort
         .SetRange Range("A1:D10")
         .SortFields.Add Key:=Range("A1"), Order:=xlAscending
         .SortFields.Add Key:=Range("B1"), Order:=xlDescending
         ' If range includes headers
         .Header = xlYes
         .Apply
    End With
End Sub
Posted by: Guest on January-18-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language