Bonjour à toutes et à tous
J'aimerais alimenter une listbox sans doublon. Est ce qu'il est possible de le faire en gardant le code ci-dessous ou bien est il necessaire de tout remanier ?
Merci par avance pour vos conseils
Philippe
J'aimerais alimenter une listbox sans doublon. Est ce qu'il est possible de le faire en gardant le code ci-dessous ou bien est il necessaire de tout remanier ?
Merci par avance pour vos conseils
Philippe
Code:
Sub RechDMaPlanifier()
Application.ScreenUpdating = False
Set ListeDM = Sheets("DmAttentePlanif").Range("A2:A" & Sheets("feuil1").Range("A65536").End(xlUp).Row)
With ListeDM
Set c = .Find("D", LookIn:=xlValues)
If Not c Is Nothing Then
firstaddress = c.Address
Do
Set c = .FindNext(c)
UserForm1.lbDMaPlanif.AddItem c.Offset(0, 1)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
Call TriListbox(UserForm1.lbDMaPlanif)
Application.ScreenUpdating = True
End Sub
Private Sub TriListbox(oListe As Object)
' Tri de la liste
Dim i As Long, j As Long
Dim temp1 As String
For i = 0 To oListe.ListCount - 1
For j = 0 To oListe.ListCount - 1
If oListe.List(i) < oListe.List(j) Then
temp1 = oListe.List(i)
oListe.List(i) = oListe.List(j)
oListe.List(j) = temp1
End If
Next j
Next i
End Sub