this is the code that was given to me to sort the array of timezones and i am using
VB Code:
Private Sub SortArray(ByRef sArray() As String) Dim i As Long Dim ArrTemp() As Long ReDim ArrTemp(UBound(sArray)) For i = LBound(sArray) To UBound(sArray) ArrTemp(i) = Val(Trim$(Mid(sArray(i), 5, 6))) Next BubbleSortNumbers ArrTemp, sArray End Sub Private Sub BubbleSortNumbers(varray() As Long, vRealarray() As String) Dim cnt1 As Long Dim cnt2 As Long Dim tmp As Long Dim tmpStr As String For cnt1 = UBound(varray) To LBound(varray) Step -1 For cnt2 = LBound(varray) + 1 To cnt1 If varray(cnt2 - 1) > varray(cnt2) Then 'Switch Positions array tmp = varray(cnt2 - 1) varray(cnt2 - 1) = varray(cnt2) varray(cnt2) = tmp 'Switch real array tmpStr = vRealarray(cnt2 - 1) vRealarray(cnt2 - 1) = vRealarray(cnt2) vRealarray(cnt2) = tmpStr End If Next cnt2 Next cnt1 End Sub ' call like this opentimezonelist ' sub to return array of timezones Dim arrsort() As String ReDim arrsort(UBound(arrdisplay)) ' array of returned timezones arrsort = arrdisplay SortArray arrsort For i = 0 To UBound(arrsort) List1.AddItem arrsort(i) Next




Reply With Quote