Ce code est très bien avec les dicos:
Sub RemoveDuplicates()
Dim i As Long
Dim myColl As New Collection
Dim LastRow As Long, FirstRow As Long
With ActiveWorksheet
FirstRow = .UsedRange.Row
LastRow = .UsedRange.Row + .UsedRange.Rows.Count - 1
On Error Resume Next
Err = 0
For i = LastRow To FirstRow Step -1
myColl.Add .Range("A" & i).Value CStr(.Range("A" & i).Value)
If Err <> 0 Then
.Range("A" & i).EntireRow.Delete
Err = 0
End If
Next i
End With
On Error GoTo 0
End Sub
Sinon tu as celui là, plus lent mais plus simple à utiliser, il va te remove les duplicates de ta selection:
Public Sub DeleteDuplicateRows()
'
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.
Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Col = ActiveCell.Column
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rn... V) > 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub