Sub Bouton2_Clic()
With Worksheets("Feuil1").Range("Tableau3")
Maj = False
For i = 1 To .Rows.Count
If .Item(i, 1) <> .Item(i, 3) Or .Item(i, 2) <> .Item(i, 4) Then
Maj = True
nb = Range("MAJ").Rows.Count + 1
Range("MAJ").Item(Range("MAJ").Rows.Count, 2) = "essai"
Range("MAJ").Item(Range("MAJ").Rows.Count, 3) = .Item(i, 1)
Range("MAJ").Item(Range("MAJ").Rows.Count, 5) = .Item(i, 3)
Range("MAJ").Item(Range("MAJ").Rows.Count, 4) = .Item(i, 2)
Range("MAJ").Item(Range("MAJ").Rows.Count, 6) = .Item(i, 4)
Sheets("MAJ").ListObjects("MAJ").Resize Range("A1:F" & nb + 1)
End If
Next i
End With
With Worksheets("MAJ")
choix = "1"
der_ligne = Range("c" & "65000").End(xlUp).Row
Dim tab_cells()
ReDim tab_cells(der_ligne - 1)
For ligne = 1 To der_ligne
tab_cells(ligne - 1) = Range("c" & ligne)
Next
nb = 0
If choix = 1 Then compteur = 0
For ligne = 1 To der_ligne
contenu = tab_cells(ligne - 1)
If (choix = 1) And ligne > 1 And contenu <> "" Then 'Effacer/supprimer doublons
For i = 1 To ligne - 1
If contenu = tab_cells(i - 1) Then 'Si doublon
nb = nb + 1
Range(ligne & ":" & ligne).ClearContents
Range(ligne + compteur & ":" & ligne + compteur).Delete
compteur = compteur - 1
End If
Next
End If
Next
End With
'If Maj Then
'MsgBox ("Mise à jour à faire")
'Else: MsgBox ("Aucune Mise à jour")
'End If
Sheets("MAJ").Activate
choix = "1"
der_ligne = Range("c" & "65000").End(xlUp).Row
ReDim tab_cells(der_ligne - 1)
For ligne = 1 To der_ligne
tab_cells(ligne - 1) = Range("c" & ligne)
Next
nb = 0
If choix = 1 Then compteur = 0
For ligne = 1 To der_ligne
contenu = tab_cells(ligne - 1)
If (choix = 1) And ligne > 1 And contenu <> "" Then 'Effacer/supprimer doublons
For i = 1 To ligne - 1
If contenu = tab_cells(i - 1) Then 'Si doublon
nb = nb + 1
Range(ligne & ":" & ligne).ClearContents
Range(ligne + compteur & ":" & ligne + compteur).Delete
compteur = compteur - 1
End If
Next
End If
Next
End Sub