Re-bonjour
Je trouve ma macro un peu lente, pouvez-vous me donnez des conseils pour l'accélerer ci-joint mon code:
Application.ScreenUpdating = False
Dim i As Long, j As Long
'afficher lignes
Macro4
'supprimer couleur
Macro5
'colorer les cellules
Columns("K:K").Select
With Selection.Interior
.Pattern = xlNone
End With
For i = 2 To 50000
If Cells(i, 6).Value = "KM RETOUR" Then
If Not Cells(i, 11).Value = "TVOI" Then
Cells(i, 11).Select
With Selection.Interior
.ColorIndex = 6
End With
End If
End If
Next i
'msg box avec le nombre d'erreurs
coul = 6
Total = 0
Range("K2:K50000").Select
For Each Cellule In Selection:
If Cellule.Interior.ColorIndex = coul Then Total = Total + 1
Next
Range("A1").Select
MsgBox "Il y a " & Total & " erreurs sur le service KMRT"
'Masquer lignes
For j = [K65536].End(xlUp).Row To 2 Step -1
If Cells(j, "K").Interior.ColorIndex = xlNone Then
Rows(j).Hidden = True
End If
Next
Application.ScreenUpdating = True
Je trouve ma macro un peu lente, pouvez-vous me donnez des conseils pour l'accélerer ci-joint mon code:
Application.ScreenUpdating = False
Dim i As Long, j As Long
'afficher lignes
Macro4
'supprimer couleur
Macro5
'colorer les cellules
Columns("K:K").Select
With Selection.Interior
.Pattern = xlNone
End With
For i = 2 To 50000
If Cells(i, 6).Value = "KM RETOUR" Then
If Not Cells(i, 11).Value = "TVOI" Then
Cells(i, 11).Select
With Selection.Interior
.ColorIndex = 6
End With
End If
End If
Next i
'msg box avec le nombre d'erreurs
coul = 6
Total = 0
Range("K2:K50000").Select
For Each Cellule In Selection:
If Cellule.Interior.ColorIndex = coul Then Total = Total + 1
Next
Range("A1").Select
MsgBox "Il y a " & Total & " erreurs sur le service KMRT"
'Masquer lignes
For j = [K65536].End(xlUp).Row To 2 Step -1
If Cells(j, "K").Interior.ColorIndex = xlNone Then
Rows(j).Hidden = True
End If
Next
Application.ScreenUpdating = True