Conditiona Formating vs VBA code

Brass Contributor

Good Evening all,

 

I have a problem I need t make an working expiry sheet.

in conditional formatting I am using =Today() but it only works when I press apply.

i input expired dates and they don't mark in red.

 

as to vba I am using the following Code


Private Sub Workbook_Open()
Dim Edate As Date
Edate = Format("ToDay", "DD/MM/YYYY") '
If Date > Edate + 2 Then
End If
End Sub

Cannot get it to change t red colour.

 

Can someone kindly help meplease

1 Reply

Try this:

 

Private Sub Workbook_Open()
    Dim Edate As Date
    Edate = Format(Date, "DD/MM/YYYY") '
    If Date > Edate + 2 Then
    End If
End Sub