Sub sortDB()
Sheet3.Select
Range("A2:Z2").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("db").AutoFilter.Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("db").AutoFilter.Sort.SortFields. _
Add Key:=Range("B2"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("db").AutoFilter.Sort.SortFields. _
Add Key:=Range("C2"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("db").AutoFilter.Sort.SortFields. _
Add Key:=Range("D2"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("db").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
End Sub
0 komentar:
Posting Komentar