UnsolvedCoding
Technical User
I have a couple of different reasons why I want to do this, but the bottom line question is this - is it possible to sort the information collected in an array?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub Quick_Sort(ByRef SortArray As Variant, ByVal First As Long, ByVal Last As Long)
'This sub performs a sort-in-place on the array "SortArray", using the quicksort algorithm.
'SortArray is the array to be sorted
'First - when first called, this should be the lowest index of the array
'Last - when first called, this should be the highest index of the array
Dim Low As Long, High As Long
Dim temp As Variant, List_Separator As Variant
Low = First
High = Last
List_Separator = SortArray((First + Last) / 2)
Do
Do While (SortArray(Low) < List_Separator)
Low = Low + 1
Loop
Do While (SortArray(High) > List_Separator)
High = High - 1
Loop
If (Low <= High) Then
temp = SortArray(Low)
SortArray(Low) = SortArray(High)
SortArray(High) = temp
Low = Low + 1
High = High - 1
End If
Loop While (Low <= High)
If (First < High) Then Quick_Sort SortArray, First, High
If (Low < Last) Then Quick_Sort SortArray, Low, Last
End Sub