In row 9 I have a set of standard benchmark numerical values but not all cells are populated. In rows 10 to 29 are a set of test results but sometimes not all rows will be populated and/or not all cells within rows will be populated. Example image attached.
I have put together the following code to loop through the range and highlight test results that are either 5-10%, 10-15% or 15+% greater than the benchmarks or 5-10%, 10-15% or 15+% lower than the benchmarks.
It seems to work for some results but skips others. Can anyone see what the issue is?
Thanks
Sub HighlightStats()
Dim r As Long, c As Long
With ThisWorkbook.Sheets("Summary")
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) >= Cells(9, c) * 1.05 And Cells(r, c) < Cells(9, c) * 1.1 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(211, 222, 241)
Next c
Next r
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) >= Cells(9, c) * 1.1 And Cells(r, c) < Cells(9, c) * 1.15 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(180, 198, 231)
Next c
Next r
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) >= Cells(9, c) * 1.5 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(110, 145, 208)
Next c
Next r
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) <= Cells(9, c) * 0.95 And Cells(r, c) > Cells(9, c) * 0.9 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(237, 219, 236)
Next c
Next r
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) <= Cells(9, c) * 0.9 And Cells(r, c) > Cells(9, c) * 0.85 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(223, 189, 221)
Next c
Next r
For r = 10 To 29
For c = 4 To 63
If Cells(9, c) <> "" And Cells(r, c) <= Cells(9, c) * 0.85 And Cells(r, c) <> "" Then Cells(r, c).Interior.Color = RGB(207, 157, 205)
Next c
Next r
End With
End Sub
