Hi folks,
I tried to sort 4 fields at the same time but it's not happening. The result does not come up to what expected. Here is the code:
Sub Sort4Fields()
Cells(1, 1).CurrentRegion.Select
With Selection
.Sort Key1:=Range("a1"), Order1:=xlAscending, _
Key2:=Range("b1"), Order2:=xlAscending, _
Key3:=Range("c1"), Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Selection
.Sort Key1:=Range("d1"), Order1:=xlAscending, _
Key2:=Range("a1"), Order2:=xlAscending, _
Key3:=Range("b1"), Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub
Thnx in advance.
I tried to sort 4 fields at the same time but it's not happening. The result does not come up to what expected. Here is the code:
Sub Sort4Fields()
Cells(1, 1).CurrentRegion.Select
With Selection
.Sort Key1:=Range("a1"), Order1:=xlAscending, _
Key2:=Range("b1"), Order2:=xlAscending, _
Key3:=Range("c1"), Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Selection
.Sort Key1:=Range("d1"), Order1:=xlAscending, _
Key2:=Range("a1"), Order2:=xlAscending, _
Key3:=Range("b1"), Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub
Thnx in advance.