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
|
Sub RechercheConsignes()
Dim X As Long, Y As Long, DerLigBase As Long, NbNonTrouves As Long
Dim Trouve As Boolean
Dim Debut As Variant, Fin As Variant, Delai As Variant
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Debut = Now
With Sheets("Feuil1")
' La dernière ligne est prise sur la colonne P
DerLigBase = .Cells(.Rows.Count, 16).End(xlUp).Row
.Range(.Cells(2, 18), .Cells(.Rows.Count, 21)).ClearContents
For X = 2 To DerLigBase
Trouve = False
If .Cells(X, 8).Value = .Cells(X, 16).Value Then Trouve = True
If Trouve = False Then
For Y = 18 To 21
If .Cells(X, Y - 17).Value <> .Cells(X, Y - 7).Value Then .Cells(X, Y) = .Cells(X, Y - 17).Value
Next Y
NbNonTrouves = NbNonTrouves + 1
End If
Trouve = False
Next X
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Fin = Now
Delai = Fin - Debut
MsgBox "Fin de traitement, lignes non trouvées : " & NbNonTrouves & vbNewLine & vbNewLine & "Début:" & vbTab & Debut & vbNewLine & "Fin:" & vbTab & Fin & vbNewLine & "Délai:" & vbTab & Round(Delai, 0), vbInformation, "Traitement terminé"
End Sub |
Partager