I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years
Thanks
I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years
Thanks
This formular in code may work
1_yr_before = DateSerial(Year(Now()) - 1, Month(Now()), Day(Now()))
yc
"Nigel" <nigelben@belmontpines.com> wrote in message
news:AA424EE1-C94C-4601-A8C7-6DAA69320AAB@microsoft.com...
>I have looked and I know it must be eady but I want to subtract 1 year from
> todays date in code, so I tried date-1 year but to no avail, I can use
> date-365 but I would like it to automatically take into account leap years
>
> Thanks
=date(year(date())-1,month(date()),day(date())) will take today's month/day
and the prior year. I'm not sure what you'd get on Feb 29 ;-).
"Nigel" wrote:
> I have looked and I know it must be eady but I want to subtract 1 year from
> todays date in code, so I tried date-1 year but to no avail, I can use
> date-365 but I would like it to automatically take into account leap years
>
> Thanks
using a formula: =EDATE(TODAY(),-12)
using VBA: dateadd("yyyy",-1,date)
cheers - voodooJoe
"Nigel" <nigelben@belmontpines.com> wrote in message
news:AA424EE1-C94C-4601-A8C7-6DAA69320AAB@microsoft.com...
>I have looked and I know it must be eady but I want to subtract 1 year from
> todays date in code, so I tried date-1 year but to no avail, I can use
> date-365 but I would like it to automatically take into account leap years
>
> Thanks
=(YEAR(TODAY()))-1
Tested & Working!
I think is the easiest way to go about it. Make sure the cell is formatted for number & NOT date
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks