nat54
XLDnaute Barbatruc
Bonjour,
J'avais récupéré je-sais-plus-où une macro permettant d'enlever les doublons d'une seule colonne
Est-ce possible de l'adapter pour qu'elle trouve les doublons en colonne A, et supprime les lignes correspondantes ?
J'ai essayé juste en changeant ce qui est en rouge mais ca ne fonctionne pas
et j'avoue que je ne comprends pas cette macro..
MERCI d'avance
J'avais récupéré je-sais-plus-où une macro permettant d'enlever les doublons d'une seule colonne
Code:
[FONT=Arial][/FONT]
[FONT=Arial]Sub ENLEVER_DOUBLONS()[/FONT]
[FONT=Arial]ListeValUniques Range[COLOR=red]("A2:A5000"),[/COLOR] Range("E1") [/FONT][COLOR=teal][FONT=Arial]‘ on met la liste en colonne 1, la liste épurée se colle en colonne E[/FONT][/COLOR][FONT=Arial][/FONT]
[FONT=Arial]End Sub[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]Sub ListeValUniques(PlageSrc As Range, CellDest As Range)[/FONT]
[COLOR=teal][FONT=Arial]'Extrait les valeurs uniques d'une colonne et les renvoie[/FONT][/COLOR]
[COLOR=teal][FONT=Arial]'dans une autre, à partir de CellDest[/FONT][/COLOR][FONT=Arial][/FONT]
[FONT=Arial]Dim Arr1, Elt, Arr2(), Coll As New Collection[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]If PlageSrc.Columns.Count > 1 Then Exit Sub[/FONT]
[FONT=Arial]Arr1 = PlageSrc.Value[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]For Each Elt In Arr1[/FONT]
[FONT=Arial]On Error Resume Next[/FONT]
[FONT=Arial]Coll.Add Elt, CStr(Elt)[/FONT]
[FONT=Arial]If Err.Number = 0 Then[/FONT]
[FONT=Arial]ReDim Preserve Arr2(1 To Coll.Count)[/FONT]
[FONT=Arial]Arr2(Coll.Count) = Elt[/FONT]
[FONT=Arial]End If[/FONT]
[FONT=Arial]On Error GoTo 0[/FONT]
[FONT=Arial]Next[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]CellDest.Resize(Coll.Count).Value = _[/FONT]
[FONT=Arial]Application.Transpose(Arr2)[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]End Sub[/FONT]
Est-ce possible de l'adapter pour qu'elle trouve les doublons en colonne A, et supprime les lignes correspondantes ?
J'ai essayé juste en changeant ce qui est en rouge mais ca ne fonctionne pas
et j'avoue que je ne comprends pas cette macro..
MERCI d'avance