Private Sub UserForm_Activate()
Dim objDictionary As Object
Dim varBereich As Variant
Dim arrDaten As Variant
Dim loZaehler As Long
Set objDictionary = CreateObject("Scripting.Dictionary")
varBereich = Range("C4", Range("C4").End(xlDown))
For loZaehler = LBound(varBereich) To UBound(varBereich)
' Eintrag wird nur übernommen wenn er im DictionaryObject noch nicht enthalten ist
objDictionary(varBereich(loZaehler, 1)) = 0
Next loZaehler
arrDaten = objDictionary.keys
QuickSort arrDaten
ComboBox1.List = arrDaten
Set objDictionary = Nothing
End Sub
Sub QuickSort(ByRef VA_Array, Optional V_Low1, Optional V_High1)
'
http://www.herber.de/forum/archiv/108to112/t109556.htm
On Error Resume Next
Dim V_Low2 As Long, V_High2 As Long
Dim V_Val1, V_Val2 As Variant
If IsMissing(V_Low1) Then
V_Low1 = LBound(VA_Array, 1)
End If
If IsMissing(V_High1) Then
V_High1 = UBound(VA_Array, 1)
End If
V_Low2 = V_Low1
V_High2 = V_High1
V_Val1 = VA_Array((V_Low1 + V_High1) / 2)
While (V_Low2 <= V_High2)
While (VA_Array(V_Low2) < V_Val1 And _
V_Low2 < V_High1)
V_Low2 = V_Low2 + 1
Wend
While (VA_Array(V_High2) > V_Val1 And _
V_High2 > V_Low1)
V_High2 = V_High2 - 1
Wend
If (V_Low2 <= V_High2) Then
V_Val2 = VA_Array(V_Low2)
VA_Array(V_Low2) = VA_Array(V_High2)
VA_Array(V_High2) = V_Val2
V_Low2 = V_Low2 + 1
V_High2 = V_High2 - 1
End If
Wend
If (V_High2 > V_Low1) Then Call _
QuickSort(VA_Array, V_Low1, V_High2)
If (V_Low2 < V_High1) Then Call _
QuickSort(VA_Array, V_Low2, V_High1)
End Sub