Subtract 1 year from todays date

G

Guest

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
 
N

new.microsoft.com

This formular in code may work

1_yr_before = DateSerial(Year(Now()) - 1, Month(Now()), Day(Now()))

yc
 
G

Guest

=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 ;-).
 
V

voodooJoe

using a formula: =EDATE(TODAY(),-12)
using VBA: dateadd("yyyy",-1,date)

cheers - voodooJoe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top