Option Explicit
Public Sub No_Doublon()
Dim intLastRow As Integer, intNbAreaX As Integer, intLigneFallow As Integer, intItemIn As Integer, intLine As Integer
Dim bytLoop As Byte, bytIndex As Byte
Dim strFullName As String
Worksheets.Add after:=Worksheets(3)
ActiveSheet.Name = "New"
Worksheets(1).Activate
' Cette boucle sert a comparer chaque combinaison(3) de feuille
For bytLoop = 1 To 3
Select Case bytLoop
' Compare les noms de la feuille 1 avec la feuille 2
Case 1
Worksheets(bytLoop + 1).Activate
bytIndex = bytLoop
ActiveSheet.Cells(1, 1).AutoFilter
' Compare les noms de la feuille 1 avec la feuille 3
Case 2
Worksheets(bytLoop + 1).Activate
bytIndex = bytLoop - 1
ActiveSheet.Cells(1, 1).AutoFilter
' Compare les noms de la feuille 2 avec la feuille 3
Case 3
bytIndex = bytLoop - 1
End Select
intLastRow = Worksheets(bytIndex).Cells.SpecialCells(xlLastCell).Row
' Boucle sur chaque ligne de la feuille de référence
For intLine = 2 To intLastRow Step 1
With Worksheets(bytIndex)
strFullName = .Cells(intLine, 1) & " " & .Cells(intLine, 2)
Cells(1, 1).AutoFilter Field:=1, Criteria1:="" & .Cells(intLine, 1)
End With
If Not strFullName = " " Then
Range(Cells(2, 1), Cells(Cells(1, 1).SpecialCells(xlCellTypeLastCell).Row, Cells(1, 1).SpecialCells(xlCellTypeLastCell).Column)).Select
If Selection.Height <> 0 Then
Selection.SpecialCells(xlCellTypeVisible).Select
With Selection.Areas
For intNbAreaX = 1 To .Count
intLigneFallow = .Item(intNbAreaX).Row - 1
For intItemIn = 1 To .Item(intNbAreaX).Count - 1
If strFullName = (Cells(intLigneFallow + intItemIn, 1) & " " & Cells(intLigneFallow + intItemIn, 2)) Then
With Rows(intLigneFallow + intItemIn)
.Copy Destination:=Worksheets("New").Cells(Worksheets("New").Cells(65000, 1).End(xlUp).Row + 1, 1)
.Clear
End With
End If
Next intItemIn
Next intNbAreaX
End With
End If
End If
Next intLine
Next bytLoop
' Copie l'ensemble des nom qui sont rester sur les feuille 1 2 et 3 sur la feuille 4
For bytLoop = 1 To 3
With Worksheets(bytLoop)
.Activate
intLastRow = .Cells.SpecialCells(xlLastCell).Row
End With
For intLine = 2 To intLastRow Step 1
If Not Cells(intLine, 1) = Empty Then
Rows(intLine).Copy Destination:=Worksheets("New").Cells(Cells(1, 1).SpecialCells(xlCellTypeLastCell).Row + 1, 1)
End If
Next intLine
Next bytLoop
End Sub