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 43 44 45 46 47 48 49 50 51 52 53 54
| Private Sub Supression()
Dim i As Long, j As Long, k As Long, T As Long
Dim tAAR, tAAR35, tPCH, tRST, tEXP
Dim tSh() As String
Application.ScreenUpdating = False
T = Timer
tAAR = Worksheets("AAR").UsedRange.Value
tAAR35 = Worksheets("AAR35").UsedRange.Value
tPCH = Worksheets("PCH").UsedRange.Value
tRST = Worksheets("RST").UsedRange.Value
tEXP = Worksheets("EXP DIF").UsedRange.Value
ReDim tSh(1 To UBound(tAAR, 1) + UBound(tAAR35, 1) + UBound(tPCH, 1))
Rempl tAAR, tSh, 0
Rempl tAAR35, tSh, UBound(tAAR, 1)
Rempl tPCH, tSh, UBound(tAAR, 1) + UBound(tAAR35, 1)
k = Application.Max(UBound(tRST, 1), UBound(tEXP, 1))
For i = 2 To UBound(tSh)
For j = 2 To k
If j <= UBound(tRST, 1) Then
If Not IsEmpty(tRST(j, 28)) Then tRST(j, 28) = IIf(tSh(i) = tRST(j, 28), Empty, tRST(j, 28))
End If
If j <= UBound(tEXP, 1) Then
If Not IsEmpty(tEXP(j, 28)) Then tEXP(j, 28) = IIf(tSh(i) = tEXP(j, 28), Empty, tEXP(j, 28))
End If
Next j
Next i
SuprDoub Worksheets("RST"), tRST
SuprDoub Worksheets("EXP DIF"), tEXP
MsgBox "Terminé en " & Timer - T & " secondes."
End Sub
Private Sub Rempl(Tini As Variant, Tfin As Variant, Nini As Long)
Dim i As Long
For i = 1 To UBound(Tini)
Tfin(Nini + i) = Tini(i, 28)
Next i
End Sub
Private Sub SuprDoub(Sh As Worksheet, Tb As Variant)
Dim LastLig As Long
With Sh
.AutoFilterMode = False
LastLig = .Cells(.Rows.Count, 1).End(xlUp).Row
.UsedRange.Value = Tb
.UsedRange.AutoFilter Field:=28, Criteria1:="="
If .Range("A1:A" & LastLig).SpecialCells(xlCellTypeVisible).Count > 1 Then .Range("A2:A" & LastLig).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub |