ich habe in meiner Datei eine UserForm erstellt mit mehreren Comboboxen.
Funktioniert soweit so wie ich es mir vorstelle. Die CBs werden aus einer Tabelle gefüllt, ohne Duplikate.
Jetzt möchte ich noch, dass wenn ich in den Comboboxen bestimmte Werte auswähle das Ergebnis daraus dann in einer ListBox ausgegeben wird.
Zur Zeit sind es 8 CBs
Nachfolgend mein Code, der wahrscheinlich alles andere als schön ist, aber funktioniert :)
Private Sub UserForm_Initialize()
Dim objDic1, objDic2, objDic3, objDic4, objDic5, objDic6, objDic7, objDic8 As Object
Dim Format As Long
Dim Seiten As Long
Dim DruckA As Long
Dim DruckB As Long
Dim Papiergewicht As Long
Dim Material As Long
Dim Verarbeitung As Long
Dim Auflage As Long
Dim Auswahl As Long
With Sheets("2SDINA4")
Format = Range("A65536").End(xlUp).Row
Seiten = Range("B65536").End(xlUp).Row
DruckA = Range("C65536").End(xlUp).Row
DruckB = Range("D65536").End(xlUp).Row
Papiergewicht = Range("E65536").End(xlUp).Row
Material = Range("F65536").End(xlUp).Row
Verarbeitung = Range("G65536").End(xlUp).Row
Auflage = Range("H65536").End(xlUp).Row
Auswahl = Range("I65536").End(xlUp).Row
End With
Set objDic1 = CreateObject("Scripting.Dictionary")
Set objDic2 = CreateObject("Scripting.Dictionary")
Set objDic3 = CreateObject("Scripting.Dictionary")
Set objDic4 = CreateObject("Scripting.Dictionary")
Set objDic5 = CreateObject("Scripting.Dictionary")
Set objDic6 = CreateObject("Scripting.Dictionary")
Set objDic7 = CreateObject("Scripting.Dictionary")
Set objDic8 = CreateObject("Scripting.Dictionary")
For Format = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic1(Cells(Format, 1).Value) = 0
Next
Me.CB1.List = objDic1.keys
For Seiten = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic2(Cells(Seiten, 2).Value) = 0
Next
Me.CB2.List = objDic2.keys
For DruckA = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic3(Cells(DruckA, 3).Value) = 0
Next
Me.CB3.List = objDic3.keys
For DruckB = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic4(Cells(DruckB, 4).Value) = 0
Next
Me.CB4.List = objDic4.keys
For Papiergewicht = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic5(Cells(Papiergewicht, 5).Value) = 0
Next
Me.CB5.List = objDic5.keys
For Material = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic6(Cells(Material, 6).Value) = 0
Next
Me.CB6.List = objDic6.keys
For Verarbeitung = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic7(Cells(Verarbeitung, 7).Value) = 0
Next
Me.CB7.List = objDic7.keys
For Auflage = 2 To Cells(Rows.Count, 1).End(xlUp).Row
objDic8(Cells(Auflage, 8).Value) = 0
Next
Me.CB8.List = objDic8.keys
End Sub