#1   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Add days to a date

With three textboxes(1,2 and 3) in a userform1.
If I insert a date in textbox1, how do I get textbox2 to show the date
(textbox1)+90 days and textbox3 to show the date (textbox1)+120 days?
Using vb code?
--
kk
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Add days to a date

Option Explicit
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(Me.TextBox1.Value) Then
Me.TextBox2.Value _
= Format(CDate(Me.TextBox1.Value) + 90, "mmmm dd, yyyy")
Me.TextBox3.Value _
= Format(CDate(Me.TextBox1.Value) + 120, "mmmm dd, yyyy")
Else
Beep
Cancel = True
End If
End Sub


kk wrote:

With three textboxes(1,2 and 3) in a userform1.
If I insert a date in textbox1, how do I get textbox2 to show the date
(textbox1)+90 days and textbox3 to show the date (textbox1)+120 days?
Using vb code?
--
kk


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Add days to a date

Excellent, brilliant.
Thank you Dave
--
kk


"Dave Peterson" wrote:

Option Explicit
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(Me.TextBox1.Value) Then
Me.TextBox2.Value _
= Format(CDate(Me.TextBox1.Value) + 90, "mmmm dd, yyyy")
Me.TextBox3.Value _
= Format(CDate(Me.TextBox1.Value) + 120, "mmmm dd, yyyy")
Else
Beep
Cancel = True
End If
End Sub


kk wrote:

With three textboxes(1,2 and 3) in a userform1.
If I insert a date in textbox1, how do I get textbox2 to show the date
(textbox1)+90 days and textbox3 to show the date (textbox1)+120 days?
Using vb code?
--
kk


--

Dave Peterson

Reply
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
Conditional Formatting Dates calculating 10 days and 30 days from a certain date Sioux[_2_] Excel Worksheet Functions 2 October 11th 07 02:04 PM
Report Date - Date Recv = Days Late, but how to rid completed date MS Questionnairess Excel Worksheet Functions 1 January 24th 07 11:05 PM
Excel Formula to calulate number of days passed from date to date K. Mack Excel Discussion (Misc queries) 8 January 4th 07 11:27 PM
formula to calculate future date from date in cell plus days Chicesq Excel Worksheet Functions 8 November 3rd 05 12:25 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Excel Worksheet Functions 2 February 10th 05 07:18 PM


All times are GMT +1. The time now is 11:09 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"