Sortierte Collection aufbauen - optimaler?
01.09.2005 01:21:52
Stephan
Prinzip:
Der Funktion werden einzelne Daten übergeben, die in eine "static" collection aufsteigend eingeordnet werden sollen.
### Modul ###
Option Explicit
Private aCol As New Collection
### Sub ###
Private Sub AddDate(ByRef aDate As clsDate)
Dim i, count As Integer
count = aCol.count
If count = 0 Then
aCol.Add aDate
Else
For i = 1 To count
If aDate.theDate < aCol.Item(i).theDate Then
aCol.Add Item:=aDate, Before:=i
Exit For
End If
Next
If i = count + 1 Then
aCol.Add aDate
End If
End If
End Sub