I use Intellicad 4 PE at work I am
a beginner VBA user and I would like to
know how can I sort itens in listbox or combobox e.g. A, b, c, not B , a, c,?
Thanks
Aldo
#2
aldo,
Before adding items to the combobox load them in an array and call the following:
Private Sub BubbleSort(aRR() As String)
Dim i As Integer, j As Integer, Low As Integer, Hi As Integer, Temp As String
Low = LBound(aRR)
Hi = UBound(aRR)
For i = Low To Hi - 1
For j = i + 1 To Hi
If aRR(i) > aRR(j) Then
Temp = aRR(i)
aRR(i) = aRR(j)
aRR(j) = Temp
End If
Next j
Next i
End Sub
Then add the contents of the array to the combobox.
ssc
Before adding items to the combobox load them in an array and call the following:
Private Sub BubbleSort(aRR() As String)
Dim i As Integer, j As Integer, Low As Integer, Hi As Integer, Temp As String
Low = LBound(aRR)
Hi = UBound(aRR)
For i = Low To Hi - 1
For j = i + 1 To Hi
If aRR(i) > aRR(j) Then
Temp = aRR(i)
aRR(i) = aRR(j)
aRR(j) = Temp
End If
Next j
Next i
End Sub
Then add the contents of the array to the combobox.
ssc