Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel input date format
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date input format | Excel Discussion (Misc queries) | |||
How do I change dates input as 20080426 to date format in Excel? | Excel Discussion (Misc queries) | |||
need help with a conditional format in regards to "date" input | Excel Discussion (Misc queries) | |||
Input Box Help - Validate Date Format | Excel Programming | |||
Excel 97, text box Input Mask, local date format | Excel Programming |