Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculating pay dates | Excel Worksheet Functions | |||
Calculating Dates | Excel Worksheet Functions | |||
Calculating Dates | Excel Worksheet Functions | |||
Calculating with dates | Excel Discussion (Misc queries) | |||
Calculating number of days between two dates that fall between two other dates | Excel Discussion (Misc queries) |