libellule85
XLDnaute Accro
Bonjour le forum,
Voila actuellement j'ai une macro qui tri automatiquement quand j'entre un nom, et je voudrais ajouter à ce tri (mais je ne sais pas comment faire) la macro éliminer doublons dont vous trouverez ci-dessous les deux codes :
Code pour le tri :
Code pour Eliminer les doublons :
Ci joint un fichier
D'avance merci pour votre aide
Voila actuellement j'ai une macro qui tri automatiquement quand j'entre un nom, et je voudrais ajouter à ce tri (mais je ne sais pas comment faire) la macro éliminer doublons dont vous trouverez ci-dessous les deux codes :
Code pour le tri :
Code:
Sub tri()
Range("A3:L100").Sort Key1:=Range("A3"), Order1:=xlAscending, Key2:=Range( _
"B3"), Order2:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
End Sub
Code pour Eliminer les doublons :
Code:
Sub EliminerDoublons()
Dim i As Integer
Dim dlg As Long
dlg = Range("A" & Rows.Count).End(xlUp).Row
With ActiveSheet
.Range("A3:A" & dlg).Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess 'trie la plage
For i = dlg + 1 To 2 Step -1
If .Range("a" & i) = Range("A" & i + 1) Then
.Range("A" & i).EntireRow.Delete
End If
Next
End With
End Sub
Ci joint un fichier
D'avance merci pour votre aide