Hi,
I have a worksheet name "HDD" and i want to change the color of the values to red when they are below 0. I use below worksheet change function however it's not changing the txt color to red. Can anyone help? Thanks
I have a worksheet name "HDD" and i want to change the color of the values to red when they are below 0. I use below worksheet change function however it's not changing the txt color to red. Can anyone help? Thanks
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
For Each thecell In Target
If (Not IsEmpty(thecell)) Then
With thecell
If Sheets("HDD").Range("A:ZZ").Value < 0 Then
Sheets("HDD").Range("A:ZZ").Font.Color = RGB(255, 0, 0)
ElseIf .Value > 0 Then
Sheets("HDD").Range("A:ZZ").Font.Color = RGB(0, 255, 0)
Else
Sheets("HDD").Range("A:ZZ").Font.Color = RGB(255, 255, 255)
End If
End With
Else
Sheets("HDD").Range("A:ZZ").Font.Color = RGB(255, 255, 255)
End If
Next
End Sub