Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi folks. I have been sorting a VBA Array using a bubble sort. I
works fine with when my VBA array is 1-D, but when I change to 2-D it get a "Subscript out of range" Error. I have an array called UnitOfferArray ReDim UnitOfferArray(1 To NumberofRows, 1 To 4) For X = 1 to 10 Next X BubbleSort UnitOfferArray Function BubbleSort(List As Variant) ' Sorts an array using bubble sort algorithm 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 = 1 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 Application.StatusBar = "Sorting " & Round(i / Last * 100, 0) "%" Next i End Functio -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting array function explanation please | Excel Worksheet Functions | |||
sorting array formula | Excel Worksheet Functions | |||
Sorting within an array | Excel Discussion (Misc queries) | |||
Sorting Names in an Array | Excel Programming | |||
Sorting a 2-dimensional array | Excel Programming |