Loop for if then calculation
Try the following code (untested)
HTH
--
AP
'-------------------------------------------
Sub colors()
Dim iRow As Long
Dim iCol As Long
'Boucle sur les colonnes
For iCol = Range("F7").Column To Range("R7").Column Step 7
'Boucle sur les lignes
For iRow = Range("F7").Row To Range("R35").Row Step 2
doRange Cells(iRow, iCol)
Next iRow
Next iCol
End Sub
Sub doRange(rngTopLeft As Range)
With rngTopLeft.Resize(2, 7)
If rngTopLeft.Value < Date Then _
.Interior.Pattern = xlSolid
If rngTopLeft.Value = 1 And .Interior.ColorIndex = 15 Then _
.Interior.ColorIndex = 37
If rngTopLeft.Value = "" Then _
.Interior.ColorIndex = 15
End With
End Sub
|