ich habe Comboboxen in einem Formular, die mit Daten aus einer Excel Liste. Der Code ist wie folgt:
Private Sub UserForm_Initialize()
'ComboBoxes füllen ohne doppelte Einträge
If ActiveSheet.Cells(2, 1).Text "" Then
Dim hsh1 As Object, hsh2 As Object, hsh3 As Object, hsh4 As Object, hsh5 As Object, hsh6 As Object
Dim i As Long, lngLR As Long
Set hsh1 = CreateObject("Scripting.Dictionary")
Set hsh2 = CreateObject("Scripting.Dictionary")
Set hsh3 = CreateObject("Scripting.Dictionary")
Set hsh4 = CreateObject("Scripting.Dictionary")
Set hsh5 = CreateObject("Scripting.Dictionary")
Set hsh6 = CreateObject("Scripting.Dictionary")
With ActiveSheet
For i = 2 To .Cells(.Rows.Count, 3).End(xlUp).Row 'letzte Zeile in Spalte A
hsh1(.Cells(i, 14).Text) = 0 'Rabatttyp
hsh2(.Cells(i, 5).Text) = 0 '5 = Shop
hsh3(.Cells(i, 12).Text) = 0 '12 = Unterkategorie
hsh4(.Cells(i, 11).Text) = 0 '11 = Überkategorie (Typ)
hsh5(.Cells(i, 1).Text) = 0 '1 = Beschreibung
hsh6(.Cells(i, 1).Text) = 0
Next
End With
NewProduct.ComboBox_rabatttyp.List = Application.Transpose(hsh1.Keys)
NewProduct.ComboBox_shop.List = Application.Transpose(hsh2.Keys)
NewProduct.ComboBox_basiccategory.List = Application.Transpose(hsh3.Keys)
NewProduct.ComboBox1_category.List = Application.Transpose(hsh4.Keys)
NewProduct.TextBox_caption.List = Application.Transpose(hsh5.Keys)
Set hsh1 = Nothing
Set hsh2 = Nothing
Set hsh3 = Nothing
Set hsh4 = Nothing
Set hsh5 = Nothing
End If
Ich möchte nun gerne eine weitere Combobox erstellen (Variable: hsh6) mit den Werten aus der Zelle und der Zeilennummer in eckiger Klammer vornedran (z.B. [6] Zellentext) angeben, sowie eine weiter Combobox mit nur der Zeilennummer erstellen.Somit bitte ich um eure Hilfe!
Vielen Dank
Grüße Freddy