LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Add exactly 1 Year in days to Textbox date

No Rick, I endorse your code, just warning about creating a False date with
a string, like Ron mentioned could happen but would not really be a
"recognized" date by Excel.
"Rick Rothstein" wrote in message
...
Did you mean your message to be a response to my posting? If so, that is
not what my code does. If you are not sure, try it out... it will not
produce Feb 29th in any year.

--
Rick (MVP - Excel)


"Mike Fogleman" wrote in message
...
Be careful if you extract the year and add 1 to it. You wouldn't want Feb
29, 2008 to become Feb 29, 2009. Add the 365 days to the Date instead of
changing the year.
Mike F
"Rick Rothstein" wrote in message
...
Here is one way (although I'm not sure what event procedure you will
want to put it in)...

Dim D As Date
If IsDate(TextBox32.Text) Then
D = CDate(TextBox32.Text)
TextBox33.Text = D + 365 - (Day(D) < Day(D + 365))
End If

--
Rick (MVP - Excel)


"Corey ...." wrote in message
...
How can i ADD 1 year to Textbox32's date entered and have it placed
into Textbox33 ?

Private Sub TextBox32_AfterUpdate()
TextBox32.Text = Format(TextBox32.Text, "ddd dd mmmm yyyy")
If TextBox32.Value < "" Then TextBox33.Value = TextBox32.Value ' <===
Gives me an error
End Sub

Corey....







 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Figure out date from total days in year bijoutery Excel Worksheet Functions 1 April 7th 09 04:43 PM
Date formula resulting in Year, Months & days Ryan_Keys Excel Worksheet Functions 3 June 30th 08 05:04 PM
Calc days between two dates and exclude leap year days scoz Excel Worksheet Functions 5 November 23rd 07 03:58 PM
Date to Days of the year Mike Smith NC Excel Worksheet Functions 3 July 6th 06 10:05 PM
i have two days and i want the difference in days, months, year maja Excel Worksheet Functions 7 April 22nd 06 01:14 AM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"