ComboBox sans doublons

Maks

XLDnaute Nouveau
Bonjour à tous,

Je souhaiterai supprimer les doublons de la TextBox_Réference1 (qui est en fait un ComboBox), je ne sais pas comment lier le code en gardant la contrainte FIND qui elle, trie les réferences...

Merci pour votre aide

Private Sub TextBox_Type1_Change()
Dim ffi, feb, fi, eb, pcn, mdb, tds, pto, mdp As Object
Dim j As Integer
Dim firstAddress

TextBox_Réference1.Clear

With Sheets("Feuil2")
For j = 2 To 555
If TextBox_Type1.Value = "FFI" Then
Set ffi = .Columns(2).Cells(j).Find(what:="FFI", LookIn:=xlValues)
If Not ffi Is Nothing Then
firstAddress = ffi.Address
Do
If TextBox_Réference1.ListIndex = -1 Then
TextBox_Réference1.AddItem Cells(j, 1)
End If
Loop While Not ffi Is Nothing And ffi.Address <> firstAddress
End If

End If

If TextBox_Type1.Value = "FEB" Then
Set feb = .Columns(2).Cells(j).Find(what:="FEB", LookIn:=xlValues)
If Not feb Is Nothing Then
firstAddress = feb.Address
Do
TextBox_Réference1.ListIndex = -1
TextBox_Réference1.AddItem Cells(j, 1)
Loop While Not feb Is Nothing And feb.Address <> firstAddress
End If
End If

Next
End With
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 023
Messages
2 084 715
Membres
102 637
dernier inscrit
TOTO33000