Sub SupprEspace()
Dim t, i&, j%, x$, k%, n&, p&
t = [A2:E4326]
For i = 1 To UBound(t)
For j = 1 To 4
x = Application.Trim(t(i, j)) 'SUPPRESPACE
k = Len(t(i, j)) - Len(x)
If k Then n = n + 1: p = p + k: t(i, j) = x
Next j, i
[A2:E4326] = t
MsgBox n & " cellules traitées et " & p & " espaces supprimés dans Tableau 1"
t = [G2:J1664]: n = 0: p = 0
For i = 1 To UBound(t)
For j = 1 To 4
x = Application.Trim(t(i, j)) 'SUPPRESPACE
k = Len(t(i, j)) - Len(x)
If k Then n = n + 1: p = p + k: t(i, j) = x
Next j, i
[G2:J1664] = t
MsgBox n & " cellules traitées et " & p & " espaces supprimés dans Tableau 2"
End Sub
Sub SupprDoublon()
Dim t, d As Object, i&, x$, n&
t = [A2:E4326]
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare 'la casse est ignorée
For i = 1 To UBound(t)
x = t(i, 1) & t(i, 2) & t(i, 3) & t(i, 4)
If x <> "" And Not d.Exists(x) Then
d(x) = ""
n = n + 1
t(n, 1) = t(i, 1): t(n, 2) = t(i, 2): t(n, 3) = t(i, 3): t(n, 4) = t(i, 4)
End If
Next i
If n Then [A2:E4326].Resize(n) = t
Range("A" & n + 2 & ":F" & Rows.Count).Delete xlUp
MsgBox 4325 - n & " lignes doublons supprimées dans Tableau 1"
t = [G2:J1664]: d.RemoveAll: n = 0
For i = 1 To UBound(t)
x = t(i, 1) & t(i, 2) & t(i, 3) & t(i, 4)
If x <> "" And Not d.Exists(x) Then
d(x) = ""
n = n + 1
t(n, 1) = t(i, 1): t(n, 2) = t(i, 2): t(n, 3) = t(i, 3): t(n, 4) = t(i, 4)
End If
Next i
If n Then [G2:J1664].Resize(n) = t
Range("G" & n + 2 & ":J" & Rows.Count).Delete xlUp
MsgBox 1663 - n & " lignes doublons supprimées dans Tableau 2"
With ActiveSheet.UsedRange: End With 'actualise la barre de défilement verticale
End Sub