hi
i have this bubblesort sub -
but at the moment it sorts all the elements in ascending order, and i need it biggest element first ie. descending...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
any idea how i change it, i guess it would be simple but i suppose it may need completely rewriting
thanks
jimmyp




Reply With Quote