wie kann ich 2 CMB ohne doppelte Werte anzeigen lassen? Mit einer CMB klappt es!
Also, ich habe in meiner Userform 2 Frames erstellt mit je einer ComboBox.
In Frame1 wird die CMB1 mit folgendem Code ohne doppelte Einträge angezeigt:
Dim lIndxA As Long ' For/Next Index - außen
Dim lIndxI As Long ' For/Next Index - innen
Dim sTemp As String ' temporärer Zwischenspeicher
Dim hsh As Object, i As Long 'für doppelte Werte in CMB
'ab hier damit keine doppelten Werte in CMB
Const iCOL As Integer = 2 '2 = Spalte B
Set hsh = CreateObject("Scripting.Dictionary")
With Sheets("Artikelliste")
For i = 5 To .Cells(.Rows.Count, iCOL).End(xlUp).Row
hsh(.Cells(i, iCOL).Text) = 0
Next
End With
Me.ComboBox1.List = Application.Transpose(hsh.Keys)
' ComboBox sortieren :
For lIndxA = 0 To Me.ComboBox1.ListCount - 1
For lIndxI = 0 To lIndxA - 1
If Me.ComboBox1.List(lIndxI) > Me.ComboBox1.List(lIndxA) Then
sTemp = Me.ComboBox1.List(lIndxI)
Me.ComboBox1.List(lIndxI) = Me.ComboBox1.List(lIndxA)
Me.ComboBox1.List(lIndxA) = sTemp
End If
Next lIndxI
Next lIndxA
In Frame2 befindet sich die ComboBox5, aber wenn ich den obigen Code kopiere und ändere, zeigt er mir trotzdem die Doppelten an.Würde mich sehr freuen, wenn jemand sich das angucken würde. Vielen Dank schon einmal im voraus.
Gruß
Heike