Re : Fichier trop lourd car pas optimisé
Bonsoir,
Essaye ce bout de code, je pense que cela peut être amélioré
Sub Test()
Dim dblLines As Double, intCols As Integer, intLine As Integer, intCol As Integer
Application.ScreenUpdating = False
Cells(21, 2).Select
dblLines = Selection.End(xlDown).Row
Cells(21, 2).Select
intCols = Selection.End(xlToRight).Column
intLine = 22
intCol = 4
Do While ActiveCell.Row <= dblLines
Cells(intLine, intCol).Select
Do While ActiveCell.Column <= intCols
If Cells(ActiveCell.Row, 2).Value = Cells(3, ActiveCell.Column).Value Then
ActiveCell.Value = "Montage"
ActiveCell.Interior.ColorIndex = 4
ElseIf Cells(ActiveCell.Row, 3).Value = Cells(3, ActiveCell.Column).Value Then
ActiveCell.Value = "Vente"
ActiveCell.Interior.ColorIndex = 3
Else
ActiveCell.Value = ""
ActiveCell.Interior.ColorIndex = xlNone
End If
intCol = intCol + 1
ActiveCell.Offset(0, 1).Select
Loop
intLine = intLine + 1
intCol = 4
ActiveCell.Offset(1, 0).Select
Loop
Cells(21, 2).Select
Application.ScreenUpdating = True
End Sub