ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort MultiDimensional Array (https://www.excelbanter.com/excel-programming/369049-sort-multidimensional-array.html)

Mushi

Sort MultiDimensional Array
 
I would like to sort a 5926x12 array. I would like it first sorted by
Column 9-(integer value)-Date
then Column 2 (integer value)-Trailor #
then Column 11 (integer value)-Destination

I want to do this in VBA since that is where the array is. To copy it
to a worksheet, sort, and then reread the array would be time consuming
when the program is ran. I would like the end product to be as if I
had used the "Data", "Sort" command in excel with the Then bys filled
in. Any help would be greatly appreciated. I have searched for this
and have not found a conclusive answer. Thanks.


NickHK

Sort MultiDimensional Array
 
Take your pick of these:
http://www.devx.com/vb2themax/Article/19900

However, given that you can do the same in a couple of lines of code AND a
worksheet, I'd take this option.
Turn off Calculation, .updating etc., and it won't take long. Excel's
algorithm for this type of thing are highly optimised and I'm sure faster
than code you could write in VBA.

NickHK

"Mushi" wrote in message
oups.com...
I would like to sort a 5926x12 array. I would like it first sorted by
Column 9-(integer value)-Date
then Column 2 (integer value)-Trailor #
then Column 11 (integer value)-Destination

I want to do this in VBA since that is where the array is. To copy it
to a worksheet, sort, and then reread the array would be time consuming
when the program is ran. I would like the end product to be as if I
had used the "Data", "Sort" command in excel with the Then bys filled
in. Any help would be greatly appreciated. I have searched for this
and have not found a conclusive answer. Thanks.





All times are GMT +1. The time now is 04:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com