e4excel,
I'm not sure why you would choose to use VBA over conditional formatting, but you can use the following as an example to get started. It looks at column A and any cell that is 0 it fills red. Make sure to put the code in the desired worksheet's Event module:
Private Sub Worksheet_Calculate()
Static rng As Range: Set rng = Intersect(Me.UsedRange, Me.[A:A])
If rng Is Nothing Then Exit Sub
rng.Interior.ColorIndex = 0
Dim rngCell As Range
For Each rngCell In rng
If Trim(rngCell.Value) <> vbNullString And rngCell.Value = 0 Then rngCell.Interior.ColorIndex = 3
Next rngCell
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheet_Calculate
End Sub
Hope that helps,
~tigeravatar
Bookmarks