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 27 28 29 30
| Sub t()
Dim c As New Collection
Dim deux As New Collection
Dim i As Long, j As Long, k As Long
Dim derlig As Long
derlig = 9
For i = 1 To derlig
On Error Resume Next
c.Add Cells(i, 1).Value, Cells(i, 1).Value 'élimine doublons
Next
For j = 1 To c.Count
Cells(j, 4).Value = c.Item(j)
Set deux = Nothing
For i = 1 To derlig
If Cells(i, 1) = c.Item(j) Then
On Error Resume Next
'deux.Add Cells(i, 2) 'affiche les doublons
deux.Add Cells(i, 2), Cells(i, 2) 'élimine les doublons
End If
Next
For k = 1 To deux.Count
Cells(j, 4 + k).Value = deux.Item(k)
Next
Next
End Sub |
Partager