Their is a mistake in QuickSort function.
You should store the key in the middle to some variable, and compare all key values to the variable but not the key in the arrKeys. The problem will cause dictionary not sort as you expect. And also, you can remove the equal from the comparison to reduce useless swap of keys and values.
Do While newLB < ub
If arrKeys(newLB) >= arrKeys(p) Then Exit Do
newLB = newLB + 1
Loop
Do While newUB > lb
If arrKeys(p) >= arrKeys(newUB) Then Exit Do
newUB = newUB - 1
Loop
Their is a mistake in QuickSort function.
You should store the key in the middle to some variable, and compare all key values to the variable but not the key in the arrKeys. The problem will cause dictionary not sort as you expect. And also, you can remove the equal from the comparison to reduce useless swap of keys and values.
Do While newLB < ub
If arrKeys(newLB) >= arrKeys(p) Then Exit Do
newLB = newLB + 1
Loop
Do While newUB > lb
If arrKeys(p) >= arrKeys(newUB) Then Exit Do
newUB = newUB - 1
Loop