wackywoo105
Registered User.
- Local time
- Today, 12:50
- Joined
- Mar 14, 2014
- Messages
- 203
I use the following code to reorganize an address list:
The problem is that address such as number 2 are placed after 18 and so on.
Can anyone provide a way to list them so 1,2,3 etc are all at the start of the list?
Code:
pvarArray() = Split(addlist, "^")
Dim p As Long
Dim iMin As Long
Dim iMax As Long
Dim varSwap As Variant
Dim blnSwapped As Boolean
iMin = LBound(pvarArray)
iMax = UBound(pvarArray) - 1
Do
blnSwapped = False
For p = iMin To iMax
If pvarArray(p) > pvarArray(p + 1) Then
varSwap = pvarArray(p)
pvarArray(p) = pvarArray(p + 1)
pvarArray(p + 1) = varSwap
blnSwapped = True
End If
Next
iMax = iMax - 1
Loop Until Not blnSwapped
For t = LBound(pvarArray) To UBound(pvarArray)
' MsgBox pvarArray(t)
Me.List2.AddItem pvarArray(t)
Next t
The problem is that address such as number 2 are placed after 18 and so on.
Can anyone provide a way to list them so 1,2,3 etc are all at the start of the list?