I am trying to sort the record source of a listbox every time something is added to it from another listbox. It works when I only use alphanumerics with the numeric part below 10 but when I go above 9 it does not sort correctly. Is ther some way to treat the numeric part as a number?
example:
one diemensonal array contents
b-4
a-10
c-1
a-3
a-1
result
a-1
a-10
a-3
b-4
c-1
desired result
a-1
a-3
a-10
b-4
c-1
Here is the procedure I am useing:
Private Sub List12_DblClick(Cancel As Integer)
List10.AddItem ("IER-" + List12.Value)
myArray = Split(List10.RowSource, ";")
For lLoop = 0 To UBound(myArray) - 1
For lLoop2 = lLoop To UBound(myArray)
If UCase(myArray(lLoop2)) < UCase(myArray(lLoop)) Then
str1 = myArray(lLoop)
str2 = myArray(lLoop2)
myArray(lLoop) = str2
myArray(lLoop2) = str1
End If
Next lLoop2
Next lLoop
List10.RowSource = Join(myArray, ";")
End Sub
example:
one diemensonal array contents
b-4
a-10
c-1
a-3
a-1
result
a-1
a-10
a-3
b-4
c-1
desired result
a-1
a-3
a-10
b-4
c-1
Here is the procedure I am useing:
Private Sub List12_DblClick(Cancel As Integer)
List10.AddItem ("IER-" + List12.Value)
myArray = Split(List10.RowSource, ";")
For lLoop = 0 To UBound(myArray) - 1
For lLoop2 = lLoop To UBound(myArray)
If UCase(myArray(lLoop2)) < UCase(myArray(lLoop)) Then
str1 = myArray(lLoop)
str2 = myArray(lLoop2)
myArray(lLoop) = str2
myArray(lLoop2) = str1
End If
Next lLoop2
Next lLoop
List10.RowSource = Join(myArray, ";")
End Sub