Hi out there,
i am trying to get the col J (date) to change colour after a certain number of days if cell F (date) is empty. Below are my codes. Could anyone tell me what i am doing wrong. Please do bare with me as i am really new at VBA.
i am trying to get the col J (date) to change colour after a certain number of days if cell F (date) is empty. Below are my codes. Could anyone tell me what i am doing wrong. Please do bare with me as i am really new at VBA.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Value > 0 Then Exit Sub
Set xRg = Intersect(Range("F1:F3000"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value = "" Then
Call HighlightCells
End If
End Sub
Sub HighlightCells()
Dim dtrg As Range: Set dtrg = Range("J1:J3000")
Dim dtCell As Range
For Each dtCell In dtrg.Cells
If dtCell.Value <> "" And dtCell.Value < Date - 40 Then _
dtCell.Interior.ColorIndex = 3
'End If
Next dtCell