Form SharePlace
Dim lstMyList List As String
Dim strTags As StringlstMyList ("B") = "List"
strTags = |"B"|
lstMyList ("A") = "Sorting"
strTags = StrTags & |:"A"|
lstMyList ("D") = "Simple"
strTags = StrTags & |:"D"|
lstMyList ("C") = "Is"
strTags = StrTags & |:"C"|
Then, use @Sort formula function to sort "lstMyList".
Dim varTagsArray As Variant
varTagsArray = Evaluate (|@sort (| & strTags & |)|)
Second choice: Bubble Sort Algorithm
Form: IBM
Sub bub_sort (in_array As Variant)
'returns a sorted array based on a complexity of O(n^2) using a bubble sort
If Not Isarray(in_array) Then
Print "bub_sort: not receiving array"
Exit Sub
End IfDim top, bot, cur, cur2 As Integer
top=Ubound (in_array)
bot=Lbound (in_array)If top=bot Then
Print "bub_sort: only one element"
Exit Sub
End IfDim tmp_element As Variant
For cur=bot To top
cur2=cur
Do While cur2 > bot 'bubble up
If (in_array(cur2) > in_array(cur2-1)) Then
Exit Do
Else
'swap
tmp_element=in_array(cur2)
in_array(cur2)=in_array(cur2-1)
in_array(cur2-1)=tmp_element
End If
cur2=cur2-1
Loop
Next
End Sub


