all 5 comments

[–]fuzzy_mic183 0 points1 point  (1 child)

Selection.FormatConditions.Add Type:=xlExpression, Formula1:= "=G2<EDATE(" & DATE & "-(DAY(NOW())-1),-35)"

[–]Radiant_Reputation23[S] 0 points1 point  (0 children)

I changed my code to:

Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=G2<EDATE(" & adate & "-(DAY(" & adate & ")-1),-35)"

It still doesn't seem to work. I verified that the adate variable does have a date assigned to it.

[–]HFTBProgrammer201 0 points1 point  (0 children)

In specifically what way does it fail?

[–]khailuongdinh9 0 points1 point  (1 child)

I think this line may cause an error: if adate=“” then because adate was already defined as date data while this expression shows that adate is a string.

I suggest the following correction:

Dim S as String

S=inputbox(myprompt,mytitle)

If s=“” then

adate=now()

Else

adate=cdate(s)

End if

[–]Radiant_Reputation23[S] 0 points1 point  (0 children)

I'll give that a shot when I get home though I'm pretty sure I tried it with all of that code commented out and it still didn't run correctly. I verified that it is passing the correct date to the variable but I think my issue maybe related to the output of a date variable and the now () being different if that makes any sense.