Bonjour,

Voici ma macro que j’exécute sur un fichier de plus de 200 000 lignes :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Sub suppression_doublons()
    vchrono = Now()
    Dim B As String
    B = InputBox("Quelle est la colonne pour supprimer les 3?")
    If B = "" Then
        'MsgBox "annulé"
    Exit Sub
    Else
    End If
         Dim C As String
    C = InputBox("Quelle est la colonne pour supprimer les doublons?")
 
 
    If C = "" Then
        MsgBox "annulé"
    Exit Sub
    Else
    End If
 
    Dim z As Long
    Partir du bas du tableau
    For z = Range(B & Rows.Count).End(xlUp).Row To 2 Step -1
    If Range(B & z) = "3" Then Range(B & z).EntireRow.Delete xlShiftUp
    Next z
 
 
Dim i&, l&, t()
     With Feuil1.Columns(C & ":" & C)
    l = .Cells(.Rows.Count).End(xlUp).Row
    t = Range(.Cells(1), .Cells(l)).Value
    With Application: .ScreenUpdating = 0: .EnableEvents = 0: .Calculation = -4135: End With
    For i = l To 3 Step -1
      If Not IsEmpty(t(i, 1)) Then If AscW(t(i, 1)) <> 9658 And IsEmpty(t(i - 1, 1)) Then .Cells(i).Value = Chr(33) & .Cells(i).Value: i = i - 1: .Parent.Rows(i).Delete
    Next
    With Application: .Calculation = -4105: .EnableEvents = 1: .ScreenUpdating = 1: End With
  End With
      Cells.Replace What:="!", Replacement:="", LookAt:=xlPart, SearchOrder:= _
        xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
  vchrono = Now() - vchrono
MsgBox Format(vchrono, "h:mm:ss")
  MsgBox ("traitement terminé")
End Sub
Elle dure 20 minutes ce qui est quand même long. Je voulais donc savoir si il y avait des choses à enlever pour gagner du temps.

Merci pour votre aide