![]() |
What is the differance between cdate and ...
I had this in my code
ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date) and I wanted to include the time as well and changed it to ActiveCell.Offset(0, 8) = TextBox_Attempt1Date Now when i evaluate the cell<today() , I am always getting true, even if the value from yesterday is in the cell. How should I code this so that I get the date and time, but also so that the comparison with today() provides valid results? Thnaks Bruce |
What is the differance between cdate and ...
No reason not to use cdate:
? typename(cdate("01/01/2003 10:53 AM")) Date ? cdate("01/01/2003 10:53 AM") 1/1/2003 10:53:00 AM Regards, Tom Ogilvy "Bruccce" wrote in message news:NOvYa.88848$uu5.12702@sccrnsc04... I had this in my code ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date) and I wanted to include the time as well and changed it to ActiveCell.Offset(0, 8) = TextBox_Attempt1Date Now when i evaluate the cell<today() , I am always getting true, even if the value from yesterday is in the cell. How should I code this so that I get the date and time, but also so that the comparison with today() provides valid results? Thnaks Bruce |
What is the differance between cdate and ...
When I use cdate(TextBox_Attempt1Date) is only has the date, not the time.
where TextBox_Attempt1Date has the date AND time. Is there a setting that controls cDate()? Bruce "Tom Ogilvy" wrote in message ... No reason not to use cdate: ? typename(cdate("01/01/2003 10:53 AM")) Date ? cdate("01/01/2003 10:53 AM") 1/1/2003 10:53:00 AM Regards, Tom Ogilvy "Bruccce" wrote in message news:NOvYa.88848$uu5.12702@sccrnsc04... I had this in my code ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date) and I wanted to include the time as well and changed it to ActiveCell.Offset(0, 8) = TextBox_Attempt1Date Now when i evaluate the cell<today() , I am always getting true, even if the value from yesterday is in the cell. How should I code this so that I get the date and time, but also so that the comparison with today() provides valid results? Thnaks Bruce |
What is the differance between cdate and ...
As I demonstrated, it has the time as well if the text string has the time.
I suspect you need to format the cell to show the time. Today at noon would look like ? cdbl(cdate(date+timevalue("12:00"))) 37840.5 If I put this in a cell Range("B9").Value = cdate(date+timevalue("12:00")) ? range("B9").Text 8/7/2003 12:00 ' but if I format the cell to just show date Range("B9").NumberFormat = "mm/dd/yyyy" ? range("B9").Text 08/07/2003 ' however, the time is still stored in the cell ? range("B9").Value 8/7/2003 12:00:00 PM I suspect you are seeing formatted output and not look at what is actually stored in the cell. Regards, Tom Ogilvy "Bruccce" wrote in message news:R1xYa.90594$YN5.64744@sccrnsc01... When I use cdate(TextBox_Attempt1Date) is only has the date, not the time. where TextBox_Attempt1Date has the date AND time. Is there a setting that controls cDate()? Bruce "Tom Ogilvy" wrote in message ... No reason not to use cdate: ? typename(cdate("01/01/2003 10:53 AM")) Date ? cdate("01/01/2003 10:53 AM") 1/1/2003 10:53:00 AM Regards, Tom Ogilvy "Bruccce" wrote in message news:NOvYa.88848$uu5.12702@sccrnsc04... I had this in my code ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date) and I wanted to include the time as well and changed it to ActiveCell.Offset(0, 8) = TextBox_Attempt1Date Now when i evaluate the cell<today() , I am always getting true, even if the value from yesterday is in the cell. How should I code this so that I get the date and time, but also so that the comparison with today() provides valid results? Thnaks Bruce |
All times are GMT +1. The time now is 04:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com