Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
CDate and IsDate Geoff Excel Programming 3 June 4th 05 02:20 PM
CDATE issues Marcus Excel Programming 1 November 12th 04 10:02 AM
CDate cannot coerce value of IsDate(true)? tkstock[_4_] Excel Programming 1 November 1st 04 04:34 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM
What is the differance between cdate and ... Bruccce Excel Programming 3 August 7th 03 09:00 PM


All times are GMT +1. The time now is 01:40 AM.

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"