Sub highlight()
'Tested and working..
Dim LastRow As Long
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
Worksheets("[COLOR=#ff0000]Sheet1[/COLOR]").Activate [COLOR=#ff8c00]'[/COLOR][COLOR=#0000ff] your worksheet name goes here [/COLOR][COLOR=#ff8c00][/COLOR]
For i = 1 To LastRow + 1
If Range("CF" & i).Value < Range("C" & i).Value Then
For j = 1 To 6
Cells(i, 5 + j).Select
If Cells(i, 5 + j) = Range("CF" & i).Value Then
Cells(i, 5 + j).Interior.ColorIndex = 3
End If
Next j
End If
Next i
End Sub
Thanks for the help
Kindly amend your code to incorporate the following
1) I have benchmark figures in Col C from row 11 owwards
2) I have values or % in Col D to K
3) Where the values or %'s < than the benchmark, these must be highlighted in red
I have tried amending your code, but could not come right
Kindly amend taking into account the above
'[URL="https://www.mrexcel.com/forum/members/howard.html"]howard[/URL][COLOR=#574123]
[/COLOR]
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
Worksheets("Sheet1").Activate ' your worksheet name goes here
Cells.Interior.ColorIndex = 0
For i = 11 To LastRow + 1
If Range("CF" & i).Value < Range("C" & i).Value Then
For j = 1 To 8
If Cells(i, 3 + j).Value < Range("CF" & i).Value Then
Cells(i, 3 + j).Interior.ColorIndex = 3
End If
Next j
End If
Next i
Excel 2012 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
C | D | E | F | G | H | I | J | K | L | |||
10 | Benchmark | |||||||||||
11 | 3.80% | 3,4% | 3.90% | 3,0% | 4.25% | 1,9% | -2.50% | 3,7% | 2,1% | |||
12 | 14,6% | 14,2% | 13.75% | 12,3% | 15.80% | 16.20% | 16.25% | 14.10% | 14,3% | |||
13 | ||||||||||||
Sheet1 |
Excel 2012 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
C | D | E | F | G | H | I | J | K | L | |||
10 | Benchmark | |||||||||||
11 | 3.80% | 3,4% | 3.90% | 3,0% | 4.25% | 1,9% | -2.50% | 3,7% | 2,1% | |||
12 | 14,6% | 14,2% | 13.75% | 12,3% | 15.80% | 16.20% | 16.25% | 14.10% | 14,3% | |||
13 | ||||||||||||
Sheet1 |