Forum Discussion

karol polubinski's avatar
karol polubinski
Brass Contributor
Jun 20, 2018

Conditiona Formating vs VBA code

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

  • Matt Mickle's avatar
    Matt Mickle
    Bronze Contributor

    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

Resources