View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RzB RzB is offline
external usenet poster
 
Posts: 27
Default Date/Time - String or Number!

Ooopppssss - error error - Apols..

Date format is dd/mm/yyyy hh:mm:ss.... Doh....
Must have had a brain failure....
Getting too old for all this high powered programming.... :-)

Dates are all reasonable...

24/06/2002 0:33:18
24/06/2002 0:34:41
17/07/2002 8:51:06
08/03/2002 6:42:28
08/04/2002 0:22:08
08/04/2002 1:15:01


You are probably on the right track though...
The top three do not convert but the bottom three do....

However - if I select the top cell, edit the 8 on the end and
replace it with an 8 it works just fine....

Thanks for your help...
Roy


"Chrissy" wrote in message
...
You say that the date is in dd/mm format. Is this the format that
your date is set? It is possible that it is treating the dates as
mm/dd and that some are therefore not possible dates.

Example

01/01 is 1 Jan in dd/mm and mm/dd
15/01 is 15 Jan in dd/mm but not a date in mm/dd so will be treated
as text.

Chrissy.

RzB wrote
I am importing some data from a database via a VBA String.
One of the fields is a Date/Time in the form of
dd/yy/mm hh:dd:ss. I stick the string into a cell using

Set xLrngCell = Worksheets("Sheet1").Cells.Item(lngRowCount,

lngColCount)
xLrngCell = strFieldContents

However when I go to the spreadsheet I find that some
of the dates will not convert to their numeric value.
If I try to format them as a General number some of
them convert but others stay as strings. If I edit one
of these strings (just removing and replacing one character)
it will "become" OK.

What is going on?

Thanks,
Roy