ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   My on-going problems with dates (https://www.excelbanter.com/excel-programming/385953-re-my-going-problems-dates.html)

Coza

My on-going problems with dates
 
OK,
Trying another aproach.
Textbox4.text = Date (23 March 2007)
Textbox11.value = 2
Whay does this code:
Range("D2").Text = DateAdd("y", TextBox11.Value, TextBox4.Text)

NOT ADD Years(Textbox11.value = "2") ?
It ADD's 2 Days to the date instead ???


Corey....



joel

My on-going problems with dates
 
Don't use this. y = Day of year, not years
Mydate = DateAdd("y", 2, "23 March 2007")
Use this instead to add two years.
Mydate = DateAdd("yyyy", 2, "23 March 2007")

"Coza" wrote:

OK,
Trying another aproach.
Textbox4.text = Date (23 March 2007)
Textbox11.value = 2
Whay does this code:
Range("D2").Text = DateAdd("y", TextBox11.Value, TextBox4.Text)

NOT ADD Years(Textbox11.value = "2") ?
It ADD's 2 Days to the date instead ???


Corey....





All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com