Calculating Dates in VBA
Thank you... knew if was simple. .
"Juan Pablo González" wrote in message
...
Its actually quite easy in VBA. A function like this for example:
Function ExpirationDate(StartDate As Date) As Date
ExpirationDate = DateAdd("yyyy", 1, StartDate) - 1
End Function
Used like:
?ExpirationDate(DateSerial(2003,6,1))
5/31/2004
--
Regards,
Juan Pablo González
"Squid" wrote in message
...
I want to write some code that will calculate a date. I
need to calcuate an expiration date. The expiration date
will always be 1 year minus a day from the effective
date. So if the effective date = 6/1/2003, then the
expiration date = 5/31/04. I can do this pretty easily
within an excel worksheet, but I would like this to
happen with code.
Thanks
Mike
|