I am trying to get my VBA code to highlight a cell Red if it doesn't have a certain set of values. But currently it is making everything Red, not what I am expecting. Can someone suggest how I can correct this.
I am also open to making the code better, but this is at least kind of working.
Thanks,
Phil
Code:
Sub RecordValueCheck()
Dim icount As Integer, Cell As Range
Application.EnableEvents = False
Application.ScreenUpdating = False
Worksheets("PIF Checker Output - Horz").Activate
icount = 0
' payvalue = 2100
With ThisWorkbook.Worksheets("PIF Checker Output - Horz")
For Each Cell In .Range("B23", .Range("B" & Rows.Count).End(xlUp))
If Cell.Value <> 1000 Or Cell.Value <> "1000" Or Cell.Value <> 2100 Or Cell.Value <> 3000 Or Cell.Value <> 5000 Then
Cell.Interior.Color = vbRed
Cell.Font.Bold = True
Cell.Font.Color = vbYellow
End If
Next
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
I am also open to making the code better, but this is at least kind of working.
Thanks,
Phil