M
Martin
Hello,
I have this code that look at the values in column 2 for each row specified
in the code (2 to 9216). I want it to colour the row everytime the value
changes. This does this perfectly except it doesnt colour the row then the
value first changes. So for example if row 2 to 6 are the same and row 7 to
10 are the same, rows 8 to 10 are formatted.
Can anyone help with this?
Dim lRow As Long
Dim lCol As Long
For lRow = 2 To 9216
If Cells(lRow, 2).Value = Cells(lRow - 1, 2) Then
If IsEmpty(Cells(lRow, 256)) Then
lCol = Cells(lRow, 256).End(xlToLeft).Column
Else
lCol = 256
End If
Range(Cells(lRow, 1), Cells(lRow, lCol)).Interior.ColorIndex = 36
End If
Next
This is a repost from earlier today, I hope I have worded it better!
Martin
I have this code that look at the values in column 2 for each row specified
in the code (2 to 9216). I want it to colour the row everytime the value
changes. This does this perfectly except it doesnt colour the row then the
value first changes. So for example if row 2 to 6 are the same and row 7 to
10 are the same, rows 8 to 10 are formatted.
Can anyone help with this?
Dim lRow As Long
Dim lCol As Long
For lRow = 2 To 9216
If Cells(lRow, 2).Value = Cells(lRow - 1, 2) Then
If IsEmpty(Cells(lRow, 256)) Then
lCol = Cells(lRow, 256).End(xlToLeft).Column
Else
lCol = 256
End If
Range(Cells(lRow, 1), Cells(lRow, lCol)).Interior.ColorIndex = 36
End If
Next
This is a repost from earlier today, I hope I have worded it better!
Martin