Date Format Problem

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Markus Scheible (anonymous_at_discussions.microsoft.com)
Date: 02/09/05


Date: Wed, 9 Feb 2005 06:53:10 -0800

Hi Markus,

I assume your problem is caused by the automatically
changing of a cell format within excel.

>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

>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

Try range("A1").Value = date1

and go to Format => Cells => Number => Custom => TT/MM/JJJJ

Best

Markus

>
>End Sub
>---------------------
>.
>


Quantcast