Try this code to see if this works as per your requirement.
Sub comparevalues()
Dim rng As Range, cell As Range, rng1 As Range, cell1 As Range
Dim lr As Long, lc As Integer
lr = Cells(Rows.Count, 1).End(xlUp).Row
lc = Cells(1, Columns.Count).End(xlToLeft).Column
Set rng1 = Range(Cells(1, 5), Cells(1, lc))
Application.ScreenUpdating = False
For Each cell1 In rng1
Set rng = Range(Cells(2, cell1.Column), Cells(lr, cell1.Column))
For Each cell In rng
If cell <> "" Then
If cell > cell.Offset(0, -4) * 0.05 Then
cell.Interior.ColorIndex = 3
End If
If cell < cell.Offset(0, -4) * 0.05 Then
cell.Interior.ColorIndex = 6
End If
End If
Next cell
Next cell1
Application.ScreenUpdating = True
End Sub
Bookmarks