i need help to complete vba datecolor codes

This should do it.

Dim rCell As Range

With Sheet1

    For Each rCell In .Range("D5:M21") ' Change the Range
        If rCell.Row Mod 2 = 1 Then ' Only odd rows
            If rCell.Value <= Date Then
                rCell.Interior.Color = vbRed
                ElseIf rCell.Value <= Date + 30 Then
                rCell.Interior.Color = RGB(255, 150, 0) ' vbOrange isn't a thing
            ElseIf rCell.Value <= Date + 90 Then
                rCell.Interior.Color = vbYellow
            End If
        End If
    Next rCell
End With

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top