Anyone can tell me how to make this work?
I'm always getting the amount of 40611 and my cells are not changing.
Any help would be appreciated.
Thanks!
Sub findate()
Dim strDate1, strDate2 As Date
strDate1 = myplage
strDate2 = Now
testdates = DateDiff("d", strDate1, strDate2)
msgbox (testdates)
Set myplage = Range("B6:N18")
For Each cell In myplage
testdates = DateDiff("d", strDate1, strDate2)
If testdates > 5 Then Range("b6").Interior.Color = RGB(200, 160, 35)
If testdates < 5 Then Range("b6").Interior.Color = RGB(255, 255, 255)
If testdates = 5 Then Range("b6").Interior.Color = RGB(50, 50, 50)
Next
End Sub
I'm always getting the amount of 40611 and my cells are not changing.
Any help would be appreciated.
Thanks!
Sub findate()
Dim strDate1, strDate2 As Date
strDate1 = myplage
strDate2 = Now
testdates = DateDiff("d", strDate1, strDate2)
msgbox (testdates)
Set myplage = Range("B6:N18")
For Each cell In myplage
testdates = DateDiff("d", strDate1, strDate2)
If testdates > 5 Then Range("b6").Interior.Color = RGB(200, 160, 35)
If testdates < 5 Then Range("b6").Interior.Color = RGB(255, 255, 255)
If testdates = 5 Then Range("b6").Interior.Color = RGB(50, 50, 50)
Next
End Sub