Sub essai()
Dim CelEvent As Range, Existe As Boolean
Dim Fin As Long, Lg As Long
Dim nEvent, nValid
Application.ScreenUpdating = False
With Feuil1
Fin = .Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To Fin
nEvent = .Cells(i, 1)
nValid = .Cells(i, 2)
' Recherche du N° événement sur la feuille Pertes
Set CelEvent = Feuil2.Range("A:A").Find(nEvent, LookIn:=xlValues, lookat:=xlWhole)
' Si N° trouvé alors Existe = True
If Not CelEvent Is Nothing Then Existe = True
' N° première ligne vide sur feuille Pertes
Lg = Feuil2.Range("A" & Rows.Count).End(xlUp).Row + 1
' Si Existe=vrai alors si nValid <> cellule B de feuille Lg = N° trouvé
If Existe = True Then
If nValid <> Feuil2.Cells(CelEvent.Row, 2) Then Lg = CelEvent.Row
End If
' Copie de la ligne sur feuille Pertes
.Range("A" & i, "BV" & i).Copy
Feuil2.Range("A" & Lg).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
' Remet Existe à Faux pour lecture prochaine cellule
Existe = False
Next i
End With
' Tri des données
Sheets("Pertes").Select
Range("A3:BW" & Range("A65536").End(xlUp).Row).Select
Selection.Sort Key1:=Range("A3"), order1:=xlAscending, Header:=xlYes, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub