Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,075
- Office Version
- 2019
- Platform
- Windows
I have the code that is suppose to find all dates older then 3yrs. However I'm confuse as to why is not giving me the intended results.
The first code works as expected....
However, when I replace the "Hard" date with a dynamic date, it does not give me the intended results. I have 2 dates that are older then 3 yrs, however the results return zero. Any clue as to why??
Thanks
The first code works as expected....
Code:
MsgBox WorksheetFunction.CountIf(Range("D15:D100"), "<11/30/2015")
However, when I replace the "Hard" date with a dynamic date, it does not give me the intended results. I have 2 dates that are older then 3 yrs, however the results return zero. Any clue as to why??
Code:
MsgBox WorksheetFunction.CountIf(Range("D15:D100"), "< Month(Date), Format(WorksheetFunction.EoMonth(Date, 0), ""dd""), Year(Date) - 3")
Thanks