View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 293
Default How can this be???

Hi kirkm,

The result you're getting is because Excel stores dates as numbers. The number 29288 is the number of days since 31/12/1899, which
corresponds with 8/03/1980.

All you need to do is to format the destination cell in the required date format. You can do this manually or in code.

--
Cheers
macropod
[Microsoft MVP - Word]


"kirkm" wrote in message ...

I'm reading the contents of a Cell - formatted as custom "dd mmm
yyyy".

The text in the Cell is "08 Mar 1980".

Reading the cell magically converts it to 8/03/1980. This is done when
referencing it via Cells(line, column).

Writing this to another sheet via

Sub WriteSheet(mVal, mL, mC)
With Worksheets("Sheet3")
.Cells(mL, mC) = mVal
End With
End Sub

Sees the cell contents become 29288.

This really happens!!! And I've done hundreds of tests.... crazy !
What could possible cause it? I've varies the formatting of the
destination cell to text, and General. No change.

Why doesn't it read what it is - and write the same thing? Isn't this
the whole point ?

Thanks - Kirk