Bonjour à tous,

J'ai emprunté ce code à PatrickToulon et je l'en remercie. Ce code permet de supprimer les doublons d'un ComboBox
Toutefois je rencontre un problème avec le message suivant : "Variable non définie" sur la ligne en rouge.
Que n'ai-je pas bien fait ?
Merci pour vos réponses

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
Private Sub UserForm_Initialize()
Me.Cmb_Fact.List = liste_sans_doublons("B6:B" & Range("B" & Rows.Count).End(xlUp).Row, "Feuil7")
Me.Labe_Info.Caption = Sheets(10).Range("D27").Value
End Sub

Private Function liste_sans_doublons(plage, Optional feuille As Variant = 1)
        Set D = CreateObject("Scripting.Dictionary")
    For Each Cel In Sheets("Ventes").Range("B6:B")
        D.Item(Cel.Value) = ""
    Next Cel
    liste_sans_doublons = D.keys
End Function