LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default date data types

Hello,
In my program, the user selects a year (exp: "2004") from a combo box. What I need to do is take the selected year and add a 9 months and 1 day to make the date be 9/1/2004. I am using the dateadd function for this. However, I use the CSng to change the "2004" to 2004. That works fine, but the CDate changes the 2004 to 6/26/1905. why is this? Any thoughts?

crop_yeara = CSng(Crop_Year)
Crop_Year1 = CDate(crop_yeara)
crop_year2 = DateAdd("m", 9, crop_year1)

thanks in advance for your help,
Bill
 
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
How can I hide unused file types from file types list in save dial Estra Q Excel Discussion (Misc queries) 1 December 17th 09 12:36 PM
Excel 2007 error "some chart types cannot be combined with other chart types. Select a different chart types" roadsidetree Charts and Charting in Excel 15 June 2nd 09 10:53 AM
Data types when importing Excel data to SQLServer [email protected] Excel Discussion (Misc queries) 1 September 27th 06 12:48 PM
Mixed data types in a cell camell Excel Discussion (Misc queries) 2 March 8th 06 08:36 PM
Test for 3 types of data Stuart[_5_] Excel Programming 5 September 15th 03 02:15 PM


All times are GMT +1. The time now is 07:50 PM.

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

About Us

"It's about Microsoft Excel"