Data Lists : Excel Sort « Excel « VBA / Excel / Access / Word






Data Lists

 
Sub sortDemo()
     With ActiveWorkbook.Worksheets("Sheet1").sort
         .SortFields.clear
         .SortFields.add Key:=range("D3"), _
                        SortOn:=SortOnValues, _
                        Order:=xlAscending, _
                        DataOption:=xlSortNormal
         .SetRange range("B4:D9")
         .HEADER = xlNo
         .MatchCase = False
         .Orientation = xlTopToBottom
         .SortMethod = xlPinYin
         .Apply
     End With
End Sub

 








Related examples in the same category