BONJOUR
je voudrais modifier cette macro pour trier une liste en colonne A puis D et H
je voudrais supprimer les lignes doublons
Merci
Option Explicit
Sub oterdoublons()
Dim N&, plage As Range
Application.ScreenUpdating = False
N = Cells(Rows.Count, "a").End(xlUp).Row
Columns("a:a").Insert
Set plage = Range("a1:i" & N)
plage.Columns(1).FormulaR1C1 = "=IF(RC[1]<>R[1]C[1],"""",NA())"
plage.Sort key1:=Range("b1"), order1:=xlAscending, key2:=Range("i1"), order2:=xlAscending, Header:=xlYes
plage.Columns(1).Value = plage.Columns(1).Value
plage.Sort key1:=Range("a1"), order1:=xlAscending, Header:=xlYes
N = Cells(Rows.Count, "a").End(xlUp).Row
If N >= 2 Then Range(Cells(2, "a"), Cells(N, "i")).Delete xlShiftUp
Columns("a:a").Delete
Application.ScreenUpdating = True
Dim i&, Rep$
Rep = ThisWorkbook.Path
For i = [A65536].End(3).Row To 1 Step -1
If Dir(Rep & "\" & Cells(i, 1) & "*") = "" Then
Rows(i).EntireRow.Delete
End If
Next
End Sub
je voudrais modifier cette macro pour trier une liste en colonne A puis D et H
je voudrais supprimer les lignes doublons
Merci
Option Explicit
Sub oterdoublons()
Dim N&, plage As Range
Application.ScreenUpdating = False
N = Cells(Rows.Count, "a").End(xlUp).Row
Columns("a:a").Insert
Set plage = Range("a1:i" & N)
plage.Columns(1).FormulaR1C1 = "=IF(RC[1]<>R[1]C[1],"""",NA())"
plage.Sort key1:=Range("b1"), order1:=xlAscending, key2:=Range("i1"), order2:=xlAscending, Header:=xlYes
plage.Columns(1).Value = plage.Columns(1).Value
plage.Sort key1:=Range("a1"), order1:=xlAscending, Header:=xlYes
N = Cells(Rows.Count, "a").End(xlUp).Row
If N >= 2 Then Range(Cells(2, "a"), Cells(N, "i")).Delete xlShiftUp
Columns("a:a").Delete
Application.ScreenUpdating = True
Dim i&, Rep$
Rep = ThisWorkbook.Path
For i = [A65536].End(3).Row To 1 Step -1
If Dir(Rep & "\" & Cells(i, 1) & "*") = "" Then
Rows(i).EntireRow.Delete
End If
Next
End Sub
Dernière édition: