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
|