PC Review


Reply
Thread Tools Rate Thread

Adding Days not years?

 
 
Coza
Guest
Posts: n/a
 
      23rd Mar 2007
Range("D2").Text = DateAdd("yyyy", TextBox11.Value, TextBox4.Value)

Why does this not add years?

Textbox11.value = "5"

Ctm


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      23rd Mar 2007
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
>
>
>

 
Reply With Quote
 
Coza
Guest
Posts: n/a
 
      24th Mar 2007
Thanks for the Reply Tom,
BUT i STILL get the code adding DAYS and NOT years???


Corey


"Tom Ogilvy" <(E-Mail Removed)> wrote in message
news:FE19D172-A938-4D3E-85C0-(E-Mail Removed)...
> 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
>>
>>
>>



 
Reply With Quote
 
Coza
Guest
Posts: n/a
 
      24th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for the Reply Tom,
> BUT i STILL get the code adding DAYS and NOT years???
>
>
> Corey
>
>
> "Tom Ogilvy" <(E-Mail Removed)> wrote in message
> news:FE19D172-A938-4D3E-85C0-(E-Mail Removed)...
>> 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
>>>
>>>
>>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel suddenly adding days and years! Seth Hill Microsoft Excel Crashes 1 25th Jan 2009 04:10 AM
how do i convert a number of days to years, months & days? =?Utf-8?B?U2FmZXR5TGVu?= Microsoft Excel Misc 1 23rd Aug 2007 01:34 AM
Convert years to years and days =?Utf-8?B?S2ltbWllIEI=?= Microsoft Excel Misc 3 7th Feb 2006 08:06 PM
Convert Years to Years/Months/Days coreymartin@gmail.com Microsoft Excel Discussion 4 4th Jan 2006 02:58 PM
convert Days to Years, Months, Days =?Utf-8?B?S2xhdWRlYm91?= Microsoft Excel Misc 3 29th Dec 2005 10:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:53 AM.