MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Sorting data by mulitple colums

Posted by Mark on September 25, 1999 6:14 AM

I am trying to sort a sheet of data by columns, which I can do by the data...sort command on the toolbar. But this only lets me sort by three columns,(ie by cloumn B then column F etc), and for the purpose of what I'm doing I really need to sort by 5 or 6 columns. I've tried just amending the VBA code but it doesn't work as 4th or 5th sort keys aren't defined. Is there a way around this?

Posted by Dave on September 28, 1999 2:10 PM

Suggest you try this...sort by keys 4 5 and 6 first, and then perform a second sort by keys 1 2 and 3. the keys 4, 5 and 6 should retain their sequence withing the hierarchy of sorts.