PDA

View Full Version : Solved: Sort adds an extra line



paul_0722
07-25-2008, 04:26 PM
I found a nice little bubble sort routine at http://www.excelwiki.com/VBA/Arrays-BubbleSort but I guess it is not designed for use with negative numbers. The attached file builds a quick array of values with some numbers in the first column. The numbers I need to sort will always include negative and postive values but not always in sorted order from least (negative) to highest (positive).

With this sort routine it seems that use of negative numbers will always add one extra blank line to the output array and I woud really like to avoid that. Can it be done?

Any help apprecitaed.

Bob Phillips
07-25-2008, 05:41 PM
Isn't it because you dimension your array to 5 elements and only load 4



Dim ArrayName(1 To 5, 1 To 8) As Variant

Change it to 4 and it works fine.

paul_0722
07-25-2008, 06:48 PM
Yep, that's it. Thanks very much.

mdmackillop
07-26-2008, 03:00 AM
Hi Paul,
Please mark your threads Solved using the thread tools dropdown.
Regards
MD