Hi Team,
In my below code Both gives me correct output , Only there is a change in Key1.
Single cell as key1
Multiple Cells as key1.
Which is Correct approach to sort the data....
Below is Sample data
Thanks
mg
In my below code Both gives me correct output , Only there is a change in Key1.
Single cell as key1
Multiple Cells as key1.
Which is Correct approach to sort the data....
VBA Code:
Sub Sorting()
'Complete Range("a2:a10") as sorting key1
Range("a1").CurrentRegion.Sort Key1:=Range("a2:a10"), Order1:=xlAscending, Header:=xlYes
'Single Range("a2")as sorting key1
Range("a1").CurrentRegion.Sort Key1:=Range("a2"), Order1:=xlAscending, Header:=xlYes
End Sub
Below is Sample data
Book4 | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Date | data1 | data2 | ||
2 | 01/11/2020 | xxx | yyyy | ||
3 | 09/11/2020 | xxx | yyyy | ||
4 | 05/11/2020 | xxx | yyyy | ||
5 | 06/11/2020 | xxx | yyyy | ||
6 | 09/11/2020 | xxx | yyyy | ||
7 | 03/11/2020 | xxx | yyyy | ||
Sheet1 |
Thanks
mg