Hi,
Have a look at this
Sub Colour_Value()
Dim Cell As Range
With ActiveSheet
Range("F2").Formula = WorksheetFunction.Min(Range("A2:E2"))
Range("F2:F9").FillDown
For Each Cell In Range("F2:F9")
If Cell.Value = Cells((Cell.Row), 1) Then
Cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
End If
If Cell.Value = Cells((Cell.Row), 2) Then
Cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
End If
If Cell.Value = Cells((Cell.Row), 3) Then
Cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent3
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
End If
If Cell.Value = Cells((Cell.Row), 4) = True Then
Cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -9.99786370433668E-02
.PatternTintAndShade = 0
End With
End If
If Cell.Value = Cells((Cell.Row), 5) = True Then
Cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent5
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
End If
Next Cell
End With
End Sub
If your the length of the columns change with every run, you should replace this
with this
("F2:F" & .UsedRange.Rows.Count)
Bookmarks