Re : tri de données...
Bonjour,
j'aurais plutot indique FILTRE et pas tri
une autre solution
Colonne A et B pour la recherche et colonne E doit être libre
Sub Uniq()
Dim R As Range, Dico As Object, x, a, b, i&, s ' déclaration des variables OK
Set Dico = CreateObject("Scripting.Dictionary")
Set ws1 = Sheets("794300")
lastrowa = Range("A65000").End(xlUp).Row
lastrowb = Range("B65000").End(xlUp).Row
plus = IIf(lastrowa < lastrowb, lastrowb, lastrowa)
Set R = Range("A1:B" & plus) ' ws1.[A65000].End(xlUp).Row)
For Each R In R ' pour chaque cellule dans le range "r"
If R <> "" Then
x = R ' ? scalaire plus rapide, évite de répéter r.Value
If Not Dico.Exists(x) Then '
Dico(x) = Dico(x) '
End If
End If
Next
'---restitution en colonne E---
Application.ScreenUpdating = False ' OK
Range("E2:E" & Rows.Count).Clear ' OK
If Dico.Count = 0 Then Exit Sub ' si vide on sort OK
a = Dico.Keys
b = Dico.Items
For i = 0 To UBound(a) ' boucle de 0 à nombre d'occurences les "array" commencent toujours à 0
Cells(i + 1, 5) = a(i)
Next
Columns(5).AutoFit
End Sub