Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
Hello! I have a problem converting string to date. Working with Excel 2003, function Cdate works fine. If I do ..Range(myCell).Value = CDate("22/02/2005") in the cell is shown 22/02/2005 (My regional configuration is dd/mm/yyyy). But if I use this program with Excel XP, the function doesn't work correctly because it tries to make a date which is the day 2 of the month 22. I've tried to do MiDate = CDate(#2/22/2005#) but it doesn't work. The solution in office XP is: ..Range(myCell).NumberFormat = "dd/mm/yyyy" ..Range(myCell).Value = "22/02/2005" But this solution doesn't work in Excel 2003!!! The problem is that I need a solution working for both versions. Is it possible to know the version of Excel? Can anyone help me please??? Thank-you!!! -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
This example displays a message box that contains the Microsoft Excel
version number and the name of the operating system. MsgBox "Welcome to Microsoft Excel version " & _ Application.Version & " running on " & _ Application.OperatingSystem & "!" "sil0000" wrote in message ... Hello! I have a problem converting string to date. Working with Excel 2003, function Cdate works fine. If I do .Range(myCell).Value = CDate("22/02/2005") in the cell is shown 22/02/2005 (My regional configuration is dd/mm/yyyy). But if I use this program with Excel XP, the function doesn't work correctly because it tries to make a date which is the day 2 of the month 22. I've tried to do MiDate = CDate(#2/22/2005#) but it doesn't work. The solution in office XP is: .Range(myCell).NumberFormat = "dd/mm/yyyy" .Range(myCell).Value = "22/02/2005" But this solution doesn't work in Excel 2003!!! The problem is that I need a solution working for both versions. Is it possible to know the version of Excel? Can anyone help me please??? Thank-you!!! -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
Try Datevalue instead of CDate.
HTH. Best wishes Harald "sil0000" skrev i melding ... Hello! I have a problem converting string to date. Working with Excel 2003, function Cdate works fine. If I do Range(myCell).Value = CDate("22/02/2005") in the cell is shown 22/02/2005 (My regional configuration is dd/mm/yyyy). But if I use this program with Excel XP, the function doesn't work correctly because it tries to make a date which is the day 2 of the month 22. I've tried to do MiDate = CDate(#2/22/2005#) but it doesn't work. The solution in office XP is: Range(myCell).NumberFormat = "dd/mm/yyyy" Range(myCell).Value = "22/02/2005" But this solution doesn't work in Excel 2003!!! The problem is that I need a solution working for both versions. Is it possible to know the version of Excel? Can anyone help me please??? Thank-you!!! -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
I've tried with DataValue and also with DataSerial, both work rigth in Excel 2003 but not correctly in XP -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
Jim, I don't know why but the information in Application.Version an Application.OperatingSystem doesn't match with my computer. I'm workin with windows XP and Office 2003, but I have Application.Version = 11.0 Application.OperatingSystem = Windows (32-bit) NT 5.01 In the computer with Windows and Office XP I have Application.Version = 10.0 Application.OperatingSystem = Windows (32-bit) NT 5.01 The version 11.0 always means Excel 2003? -- sil000 ----------------------------------------------------------------------- sil0000's Profile: http://www.excelforum.com/member.php...fo&userid=2546 View this thread: http://www.excelforum.com/showthread.php?threadid=38902 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
I have multiple versions on this computer and it is set to dd mm yyyy date
format. Datevalue("22/02/2005") works perfect on Excel 2003 and Excel XP. Your problem is elsewhere. There is btw a difference between Data and Date HTH. Best wishes Harald "sil0000" skrev i melding ... I've tried with DataValue and also with DataSerial, both work rigth in Excel 2003 but not correctly in XP -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
yes Ver 11.?? is Office 2003.
"sil0000" wrote in message ... Jim, I don't know why but the information in Application.Version and Application.OperatingSystem doesn't match with my computer. I'm working with windows XP and Office 2003, but I have Application.Version = 11.0 Application.OperatingSystem = Windows (32-bit) NT 5.01 In the computer with Windows and Office XP I have Application.Version = 10.0 Application.OperatingSystem = Windows (32-bit) NT 5.01 The version 11.0 always means Excel 2003?? -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDate Problem
Hi Jim and Harald! I was wrong in the other message, DateSerial and DateValue were the functions that didn't work Finally I've chosen the option of get the Version and pass the value in a different way depending on the version, it's not the solution I like best but it's the only one that works.. Thank-you for your help!! -- sil0000 ------------------------------------------------------------------------ sil0000's Profile: http://www.excelforum.com/member.php...o&userid=25460 View this thread: http://www.excelforum.com/showthread...hreadid=389020 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
CDate and IsDate | Excel Programming | |||
CDATE issues | Excel Programming | |||
CDate cannot coerce value of IsDate(true)? | Excel Programming | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming | |||
What is the differance between cdate and ... | Excel Programming |