Bonsoir à tous,
Pas très clair en effet
Tes données à partir de la ligne 1, sans en-têtes
Option Explicit
Sub Retenir_le_premier()
Dim r As Range, x As Range
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For Each r In Sheets(1).Range("a1").CurrentRegion.Columns(1).Cells
If Not .exists(r.Value & r.Offset(, 1).Value) Then
.Item(r.Value & r.Offset(, 1).Value) = Empty
Else
If x Is Nothing Then
Set x = r.EntireRow
Else
Set x = Union(x, r.EntireRow)
End If
End If
Next
If Not x Is Nothing Then x.Select
'If Not x Is Nothing Then x.Delete
Set x = Nothing
End With
End Sub
Le code réajusté pour répondre au post #4
Option Explicit
Sub Retenir_le_premier()
Dim r As Range, x As Range, rng As Range
With Sheets("Feuil1")
Set rng = .Range("a2", .Range("a" & Rows.Count).End(xlUp))
End With
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For Each r In rng
If Not .exists(r.Value & r.Offset(, 1).Value) Then
.Item(r.Value & r.Offset(, 1).Value) = Empty
Else
If x Is Nothing Then
Set x = r.EntireRow
Else
Set x = Union(x, r.EntireRow)
End If
End If
Next
If Not x Is Nothing Then x.Select
'If Not x Is Nothing Then x.Delete
Set x = Nothing
Set rng = Nothing
End With
End Sub
klin89