VBA - Bubble Sort. A Bubble Sort Is A Technique To Order - by Breakcorporate - Medium
VBA - Bubble Sort. A Bubble Sort Is A Technique To Order - by Breakcorporate - Medium
For i = 0 to Ubound(sortArray)
holdInt = sortArray(x)
sortArray(x) = sortArray(i)
sortArray(i) = holdInt
end if
Next x
Next i
The code should sort the array in ascending order. The outer loop runs
through every item in the array from index 0 to the upper bound 9. The
inner loop runs from the upper bound 9 to i + 1. Step-1 indicates that the
iteration will be negative. So step-1 would go from 9 to 1.
For example:
or
You cannot check the Ubound (upper bounds) of an array if it does not have
a dimension.
It is also important…
84 1