LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Calling Bubble Sort Function

I have an 1D array that I have filled within a For Next Loop. There
are roughly 60,000 values within the array. Upon filling the array, I
want to sort the data within the array. The array is called
CalculationArray. When I call the bubble sort function, it fails
within the function and gives a type mismatch error. (It fails on "For
i = 1 To List - 1").

Why is this so?


'Call Sort Function and Sort Bidding Array

BubbleSort CalculationArray

Function BubbleSort(List As Variant)
' Sorts an array using bubble sort algorithm
Dim First As Long, Last As Long
Dim i As Long, j As Long
Dim Temp As Long

First = LBound(List)
Last = UBound(List)
For i = 1 To List - 1 'THIS IS WHERE IT FAILS
For j = i + 1 To List
If List(i) List(j) Then
Temp = List(j)
List(j) = List(i)
List(i) = Temp
End If
Next j
Next i

End Function

Thanks

TS
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 'bubble' chart where colors are used instead of bubble size paulmichael Charts and Charting in Excel 3 December 5th 07 03:33 PM
How can I change the color of negative bubble in bubble chart Jon Peltier Charts and Charting in Excel 0 July 4th 07 03:29 PM
How can I change the color of negative bubble in bubble chart Daniel Charts and Charting in Excel 1 July 4th 07 03:25 PM
ho to change in the bubble chart the bubble position and size laszlo Charts and Charting in Excel 0 March 25th 05 04:45 PM
How do I move a hidden bubble to the front in a bubble chart in E. Scott Excel Discussion (Misc queries) 0 February 20th 05 07:55 PM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"