When sorting within VBA, you can do all 8 columns, though a bit tricky as it
won't be all done in one go. The way to do it is to first have 7th field as
the Key1 and 8th field as Key2. Next round of sort, have 4th field as Key1,
5th field as Key2, and 6th field as Key3, then on the last sort, have 1st
field as Key1, 2nd field as Key2, and 3rd field as Key3.
Yes, you are in a sense going backwards, but it's about the only way to be
able to do it without having to create your own custom code to handle it.
--
Thanks,
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"greg" wrote in message
...
Hello,
I am writing a program that needs to get data. I will be combining a
bunch of tables into one table. It might have about 8 columns.
Programmatically I need to sort the columns. Not just a a single column.
But by all the columns. I looked at this manual sort soln:
http://support.microsoft.com/kb/268007
Is a pivot table the way to go?
Or just run a sort with lots of Key<num=<location
Range("A40:D48").Select
Selection.Sort Key1:=Range("C40"), Order1:=xlAscending,
Key2:=Range("B40" _
), Order2:=xlAscending, Key3:=Range("A40"), Key3:=Range("D40"),
Order3:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom _
, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
DataOption3:= _
xlSortNormal
thanks for any input