excel input date format
Noel,
Change
Selection.FormulaR1C1 = myDateP1
to
Selection.FormulaR1C1 = CDate(myDateP1)
--
HTH
RP
(remove nothere from the email address if mailing direct)
"NoelH" wrote in message
...
Hi
Thanks in advance for any help.
I have this small macro
Dim myDateP1
myDateP1 = InputBox("Enter START date for report PERIOD in
dd-mm-yy
format")
If myDateP1 < "" Then
If IsDate(myDateP1) Then
' MsgBox "Continue the macro"
' Selection.NumberFormat = "dd/mm/yyyy"
' ActiveCell.Offset(0, 2).Range("A1").Select
Selection.FormulaR1C1 = myDateP1
Range("n4").Select
Selection.FormulaR1C1 = "=(r[-3]c)"
' Selection.NumberFormat = "dd/mm/yyyy"
Else
MsgBox "You did not enter a date"
End If
End If
seeking the user to input a date, in the format dd/mm/yy This part work.
However when the date is placed into the cell the format becomes mm/dd/yy.
I know I'm doing something wrong and it might be the new year blues.
Is anyone able to guide me. as you can see by the rem I've tryied
formating
the cells.
Thanks
Noel
|