The best way to make sure the date is how you want is to use dateserial
Sub Test123()
Dim Date_str As Date
Date_str = DateSerial(2012, 3, 1)
Range("A1") = Date_str
MsgBox Month(Date_str) ' to prove that it is march
End Sub
I just added the message box to prove that the month is 3 i.e. march OR use CDate
Sub Test()
Dim Date_str As String
Date_str = "01-03-2012" ' = 1 March 2012
Range("A1") = CDate(Date_str)
MsgBox Month(Range("A1").Value) ' to prove that it is march
End Sub
CDate will convert string data type to Date data type
Bookmarks