Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sort function - from ascending to descending
hi i have this bubblesort sub - Code: -------------------- Sub BubbleSort(List() As Integer) Dim First As Integer, Last As Integer Dim i As Integer, j As Integer Dim Temp As Integer First = LBound(List) Last = UBound(List) For i = First To Last - 1 For j = i + 1 To Last If List(i) List(j) Then Temp = List(j) List(j) = List(i) List(i) = Temp End If Next j Next i End Sub -------------------- but at the moment it sorts all the elements in ascending order, and i need it biggest element first ie. descending... any idea how i change it, i guess it would be simple but i suppose it may need completely rewriting thanks jimmyp -- jimmyp ------------------------------------------------------------------------ jimmyp's Profile: http://www.excelforum.com/member.php...o&userid=32217 View this thread: http://www.excelforum.com/showthread...hreadid=522186 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Column sort with Ascending / Descending Arrows | Excel Worksheet Functions | |||
Ascending Sort formula, change to neg #: descending sort.. | Excel Discussion (Misc queries) | |||
How to sort out (ascending or descending) automatically a list | Excel Worksheet Functions | |||
Sort other than by alphabetical ascending/ descending | Excel Discussion (Misc queries) | |||
how can I hide sort ascending and sort descending options in the . | Excel Discussion (Misc queries) |