Code:

`https://wellsr.com/vba/2018/excel/vba-quicksort-macro-to-sort-arrays-fast/`

has been adapted as follows:

Code:

```
Sub Quicksort(vArray As Variant, arrLbound As Long, arrUbound As Long)
'Sorts a one-dimensional VBA array from smallest to largest
'using a very fast quicksort algorithm variant.
Dim pivotVal As Variant
Dim vSwap As Variant
Dim tmpLow As Long
Dim tmpHi As Long
tmpLow = arrLbound
tmpHi = arrUbound
pivotVal = vArray((arrLbound + arrUbound) \ 2, 1)
While (tmpLow <= tmpHi) 'divide
While (vArray(tmpLow, 1) < pivotVal And tmpLow < arrUbound)
tmpLow = tmpLow + 1
Wend
While (pivotVal < vArray(tmpHi, 1) And tmpHi > arrLbound)
tmpHi = tmpHi - 1
Wend
If (tmpLow <= tmpHi) Then
vSwap = vArray(tmpLow, 1)
vArray(tmpLow, 1) = vArray(tmpHi, 1)
vArray(tmpHi, 1) = vSwap
tmpLow = tmpLow + 1
tmpHi = tmpHi - 1
End If
Wend
If (arrLbound < tmpHi) Then Quicksort vArray, arrLbound, tmpHi 'conquer
If (tmpLow < arrUbound) Then Quicksort vArray, tmpLow, arrUbound 'conquer
Sheet3.Cells(1, 3).Resize(UBound(vArray, 1), 1).Value = vArray
End Sub
```

I use it like this:

Code:

```
Sub abc()
Dim MyArray() As Variant
MyArray() = Sheet3.Cells(1, 1).CurrentRegion.Value
Call Quicksort(MyArray(), LBound(MyArray), UBound(MyArray))
End Sub
```

What I don't understand is when I break a breakpoint in Quicksort on this line:

Code:

`Sheet3.Cells(1, 3).Resize(UBound(vArray, 1), 1).Value = vArray`

after executing that line, it immedaitely jumps to this line above, ie:

Code:

`If (tmpLow < arrUbound) Then Quicksort vArray, tmpLow, arrUbound 'conquer`

I expected it t run to End Sub and then End.

Can someone please explain.

Thanks