Option
Explicit
Sub
Farbändern()
Dim
rngRow
As
Excel.Range
Dim
rgbColor(0
To
1)
As
XlRgbColor
Dim
i
As
Long
With
Range(
"A2:G12"
)
rgbColor(0) = XlRgbColor.rgbCornflowerBlue
rgbColor(1) = XlRgbColor.rgbLightGrey
For
Each
rngRow
In
.Rows
If
rngRow.Cells(5).Value = rngRow.Cells(5).Offset(-1).Value _
Or
rngRow.Row = .Rows(1).Row _
Then
rngRow.Interior.Color = rgbColor(i)
Else
If
i = 0
Then
i = 1
Else
i = 0
rngRow.Interior.Color = rgbColor(i)
End
If
Next
End
With
End
Sub