View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mario mario is offline
external usenet poster
 
Posts: 26
Default Date Format Problem

I have the following bit of code below that for some reason when run a
message box displays 01/02/2005 as it should but when the value is placed in
a cell it changes to 02/01/2005. I have tried this with month 03, 04 etc and
still the same. I have tried formatting the cell before hand and even
afterwards it thinks its 2nd Jan 2005 rather than 1st Feb 2005 (British
region).
Any ideas anyone???

Thanks
MC
---------------------------
Sub WRITEDATE()
Dim dateandtime As String

dateandtime = "01/02/2005 08:35"
date1 = Left(dateandtime, 10)
MsgBox date1 'to test
Cells(1, 1) = date1 'have tried cells(1,1).value=date1 but same results

End Sub
---------------------