Combobox Userform: Dictionary
11.12.2019 14:24:56
Albert
habe folgenden Code im Forum gefunden und schon ein wenig abgeändert :
Private Sub UserForm_Initialize()
Dim avntValues As Variant, vntItem As Variant
Dim objDictionary As Object
With Worksheets("Stückliste")
avntValues = .Range(.Cells(1, 3), .Cells(.Rows.Count, 3).End(xlUp)).Value2
End With
Set objDictionary = CreateObject(Class:="Scripting.Dictionary")
For Each vntItem In avntValues
objDictionary.Item(Key:=vntItem) = vbNullString
Next
ComboBox1.List = objDictionary.Keys
ComboBox1.ListIndex = 2
ComboBox2.List = objDictionary.Keys
ComboBox2.ListIndex = 2
Set objDictionary = Nothing
End Sub
Wie kann ich die aktuell die ersten beiden Dictionary Einträge löschen und anschließend den Rest alphabetisch sortieren.
Vielen Dank im voraus.
Gruß Albert
Anzeige