The code below compares the cells in “H” to the cells in “G” and colors the “H” cells if the 2 dates (values) are equal.
I can successfully get it to work with = but how do I alter this code to only color “H” cells when the dates (values) in “H” are 2 days greater than the dates(values) in “G” cells?
I tried several variations:
If Range("H" & i).Value = Range("G" & i).Value + 2 Then
If Range("H" & i).Value >= Range("G" & i).Value + 2 Then
But they won’t work
Any help would be gratefully appreciated
Thank you,
Vinnie
*********************************
Private Sub Workbook_Open()
Dim i As Long, myLastRow As Long
For i = 3 To myLastRow
If Range("H" & i).Value <> "" Then
If Range("H" & i).Value = Range("G" & i).Value Then
Range("H" & i).Interior.ColorIndex = 5
End If
End If
Next i
End Sub
I can successfully get it to work with = but how do I alter this code to only color “H” cells when the dates (values) in “H” are 2 days greater than the dates(values) in “G” cells?
I tried several variations:
If Range("H" & i).Value = Range("G" & i).Value + 2 Then
If Range("H" & i).Value >= Range("G" & i).Value + 2 Then
But they won’t work
Any help would be gratefully appreciated
Thank you,
Vinnie
*********************************
Private Sub Workbook_Open()
Dim i As Long, myLastRow As Long
For i = 3 To myLastRow
If Range("H" & i).Value <> "" Then
If Range("H" & i).Value = Range("G" & i).Value Then
Range("H" & i).Interior.ColorIndex = 5
End If
End If
Next i
End Sub