Re : Un autre problème de traitement dans un gros fichier
Bonjour,
J'ai mis certaines lignes en gras car je me demande comment rendre dynamique en utilisant des variables plutôt que de hardcoder les colonnes. Dans la seconde ligne, vous inscrivez "Application.CutCopyMode = False". À quoi cela sert-il?
Sub SupprDoublons()
Dim tablo, xNA As Range
Application.ScreenUpdating = False
Set tablo = [b1].CurrentRegion
Columns(tablo.Column + 1).Insert
tablo.Select
tablo.Sort key1:=[h1], order1:=xlAscending, key2:=[c1], order2:=xlAscending, key3:=[d1], order3:=xlAscending, Header:=xlYes
tablo.Columns(2).Offset(1).FormulaR1C1 = _
"=IF(AND(RC[6]=R[-1]C[6],RC[1]=R[-1]C[1],OR(RC[2]=R[-1]C[2],RC[2]="""")),NA())"
tablo.Columns(2).Value = tablo.Columns(2).Value
tablo.Sort key1:=[b1], order1:=xlAscending, Header:=xlYes
On Error Resume Next
Set xNA = tablo.Columns(2).SpecialCells(xlCellTypeConstants, 16)
On Error GoTo 0
If Not xNA Is Nothing Then
tablo.Rows(xNA.Row & ":" & tablo.Row + tablo.Rows.Count).Clear
End If
tablo.Columns(2).Delete
Application.CutCopyMode = False
Columns("A:G").EntireColumn.AutoFit
Application.Goto [a1], True
Application.ScreenUpdating = True
End Sub