Enlever les doublons dans une combobox
Bonjour à tous,
J'ai un code qui me permet de charger ma combobox par ordre alphabétique.
Est-il possible d'enlever les doublons en plus ?
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Private Sub UserForm_Initialize()
Dim plage As Integer, PlageTri As Integer
Dim base As String
Set ws = Sheets("Synthèse")
With Me.ComboBoxSouhait1
For plage = 5 To 40
Text = ws.Cells(plage, 1)
If Text <> "" And ws.Cells(plage, 4) > 0 Then
.AddItem ws.Range("A" & plage)
End If
Next plage
End With
For plage = 0 To ComboBoxSouhait1.ListCount - 1
For PlageTri = 0 To ComboBoxSouhait1.ListCount - 1
If ComboBoxSouhait1.List(plage) < ComboBoxSouhait1.List(PlageTri) Then
base = ComboBoxSouhait1.List(plage)
ComboBoxSouhait1.List(plage) = ComboBoxSouhait1.List(PlageTri)
ComboBoxSouhait1.List(PlageTri) = base
End If
Next PlageTri
Next plage
End Sub |
Merci pour votre aide.