View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Coza Coza is offline
external usenet poster
 
Posts: 38
Default Adding Days not years?

CORRECTION.
My mistake.

As i had an IF statement, i placed it in the option 2 and the option 1 was
selected and thus didi not work.

You code works greate TOM.
Thank you.

"Coza" wrote in message
...
Thanks for the Reply Tom,
BUT i STILL get the code adding DAYS and NOT years???


Corey


"Tom Ogilvy" wrote in message
...
Try:
Range("D2").Value = DateAdd("yyyy", Clng(TextBox11.Value),
cdate(TextBox4.Value))

I guess Range("D2").Text was for illustration since that would raise an
error.

? dateAdd("yyyy",3,Date)
03/23/2010

? dateAdd("yyyy",3,"11/22/1998")
11/22/2001


--
Regards,
Tom Ogilvy


"Coza" wrote:

Range("D2").Text = DateAdd("yyyy", TextBox11.Value, TextBox4.Value)

Why does this not add years?

Textbox11.value = "5"

Ctm