Option Explicit
Sub Essai()
If ActiveSheet.Name <> "DEXT" Then Exit Sub
Dim n&: n = Cells(Rows.Count, 4).End(3).Row: If n = 1 Then Exit Sub
Dim T, r As Range, ref$, i&, j&: T = [A1].Resize(n, 10): j = 1
Application.ScreenUpdating = 0
With Worksheets("RESULTAT")
.Columns("A:J").ClearContents 'pour effacer d'éventuels anciens résultats
For i = 2 To n
ref = T(i, 4)
If ref <> T(i - 1, 4) Then
Set r = Worksheets("COALA").Columns(4).Find(ref, , -4163, 1, 1)
If r Is Nothing Then
With .Cells(j, 1)
.Value = T(i, 1) 'date
.Offset(, 1) = T(i, 2) 'journal
.Offset(, 2) = T(i, 3) 'compte
.Offset(, 3) = ref 'piece
.Offset(, 4) = T(i, 5) 'libelle
.Offset(, 5) = T(i, 6) 'debit
.Offset(, 6) = T(i, 7) 'credit
.Offset(, 7) = T(i, 8) 'monnaie
.Offset(, 8) = T(i, 9) 'originePiece
.Offset(, 9) = T(i, 10) 'refDocument
End With
j = j + 1
End If
End If
Next i
.Select
End With
End Sub