Se7enSquared
10/18/2019 - 11:38 PM

Sort table

Sorts a table by the given columns and keys

Public Sub SortTable()
    With ActiveWorkbook.Worksheets("HDDNotes").ListObjects("tblNotes").Sort
        .SortFields.Clear
        .SortFields.Add Key:=Range("tblNotes[Type]"), SortOn:=xlSortOnValues, Order:=xlAscending
        .SortFields.Add Key:=Range("tblNotes[Size]"), SortOn:=xlSortOnValues, Order:=xlAscending
        .SortFields.Add Key:=Range("tblNotes[HPPartNumber]"), SortOn:=xlSortOnValues, Order:=xlAscending
        .Header = xlYes
        .Apply
    End With
End Sub