JC wrote:
I think you are correct in that Excel will only allow a 3 layer sort. If you
run a macro with 3 sort keys and then click on the Sort option the 3 keys used
in the macro are selected.
The rows must remain intact. What I am trying to do is sort the order in which
the complete rows appear so that like entries appear together. Two independent
sorts won't necessarily achieve that.
I have got around the 3 level sort restriction by changing the sort helpers from
4 helpers H=a, I=b, J=c and K=d to 2 helpers H=1000*a+b and I=1000*c+d where
a.b.c.d is the IP address. This automatically inserts leading 0's in the b and
d components as required and allows me to sort on the IP address and date.
Thank you for your help with this problem. You've given me the clues to sort
through the coding and end up with the result I wanted. Take a bow, Sir!
-------------
Two separate sorts will do it very well. Just try it -- you'll see.
That's the technique that's been taught in computer science for the last
30 years at least.
The rows remain intact if you tell Excel to sort the entire rows based
on the keys in the one column of interest.
Even when Excel is told to do the three level sort, I suspect under the
covers it's just doing the simple one column sort independently three
times. That would be the simplest way to code it and possibly the fastest.
Bill
|