PDA

View Full Version : Sorting through two lists



grandflavour
10-24-2008, 12:29 AM
Hey everyone.

Im trying to sort information through one column first then the second column. Eg:

1 2
1 3
2 2
1 1
2 1

should be

1 1
1 2
1 3
2 1
2 2

but its

1 2
1 3
1 1
2 2
2 1

Im using:

Range(Cells(2, 1), Cells(8, 8)).Sort Key1:=Cells(2, 1)

at the moment.

Any help greatly appreciated.

GTO
10-24-2008, 12:37 AM
You just left out the second sort key. Try:

Range(Cells(2, 1), Cells(8, 8)).Sort Key1:=Cells(2, 1), Key2:=Cells(2, 2)

Mark

grandflavour
10-24-2008, 12:47 AM
Thanks Mark, you're a legend!

GTO
10-24-2008, 12:53 AM
Me? Not even close, more at, "hey, I think I got that one right!"

Thanks though and happy to help,

Mark