Supprimer les doublons a partir du bas ver le haut

Bonsoir , je tiens a m'excuser pour les fautes d'orthographe.

j'aurai besoin d'aide pour modifier une macro VBA.

la macro supprime tous les doublons par cellule (sauf le premier) sur toutes la colonnes et elle commence par la première ligne.

j'aimerai bien modifier la macro a fin de commencer par la dernières ligne ,

voici la macro

Sub DeleteDuplicateEntries()

Dim Cell As Range, Cel As Range, N&

Application.ScreenUpdating = False

N = 0

For Each Cell In Selection

'1st loop - (to speed things up ignore any empty cells)

If Cell <> Empty Then

For Each Cel In Selection

'2nd loop - compare non-empty cel values

'and clear contents if it's a duplicated value

If Cel <> Empty And _

Cel.Value = Cell.Value And _

Cel.Address <> Cell.Address Then

Cel.ClearContents

N = N + 1

End If

Next Cel

End If

Next

Application.ScreenUpdating = True

MsgBox "There were " & N & " duplicated entries deleted"

End Sub

Merci

Bonjour,

Merci de joindre un fichier à ta demande.

Cdlt.

Bonjour

Voici le fichier en pièce jointe

Merci bcp

Re,

Essaie ainsi :

Sub DeleteDuplicateEntries2()
Dim lastCol As Long, lastRow As Long
Dim rngData As Range, ACell As Range, Cell As Range
Dim I As Long, J As Long, n As Long

    Application.ScreenUpdating = False
    Set rngData = Selection
    lastCol = rngData.Columns.Count
    lastRow = rngData.Rows.Count
    For I = lastRow To 1 Step -1
        For J = lastCol To 1 Step -1
            Set ACell = rngData.Cells(I, J)
            For Each Cell In rngData
                If Cell <> Empty And _
                   Cell.Value = ACell.Value And _
                   Cell.Address <> ACell.Address Then
                    Cell.ClearContents
                    n = n + 1
                End If
            Next Cell
        Next J
    Next I
    Application.ScreenUpdating = True
    MsgBox "There were " & n & " duplicated entries deleted"

    Set ACell = Nothing: Set rngData = Nothing
End Sub

ça marche trop bien

Merci bcp

Re,

Pense à clore le sujet.

Cdlt.

Rechercher des sujets similaires à "supprimer doublons partir bas ver haut"