Hi there,
I am really new with all this. I am trying to get any cells in col J to change font/cell color once the date in col J hits more than 40 days. But the VBA codes doesn't seem to work.
Below is the code I have...
Sub HighlightCells()
Dim DischargeDate As Date: Set DischargeDate = Range("J1:J3000")
Dim fortyDys As Integer: Set fortyDys = 40
For Each DischargeDate In DischargeDate.Cells
If DischargeDate.Value > DischargeDate.Value + fortyDys Then
DischargeDate.Interior.ColorIndex = 3
End If
Next DischargeDate
End Sub
I am really new with all this. I am trying to get any cells in col J to change font/cell color once the date in col J hits more than 40 days. But the VBA codes doesn't seem to work.
Below is the code I have...
Sub HighlightCells()
Dim DischargeDate As Date: Set DischargeDate = Range("J1:J3000")
Dim fortyDys As Integer: Set fortyDys = 40
For Each DischargeDate In DischargeDate.Cells
If DischargeDate.Value > DischargeDate.Value + fortyDys Then
DischargeDate.Interior.ColorIndex = 3
End If
Next DischargeDate
End Sub