I have a Excel Sheet with below columns .
A B C D
Worker Work Start Date Work End Date Working Period(B-C)
1 1/1/2014 1/10/2014 0 Years 0 Months 10 Days
2 1/1/2014 2/28/2014 0 Years 2 Months 00 Days
I have Userform that will accept these values from the textbox and store in Excel sheet.
Problem is When is input Dates[in dd/mm/yyyy format] as 15/07/2014 it accepts and save it as 15/07/2014 in DD/MM/YYYY format in Excel Sheet .
If i give 15/17/2014 it throws error Date should be in DD/MM/YYYY
Same thing If i give Date as 07/15/2014 it accepts the date and in Excel column it saves as 7/15/2014 while it displays 15/07/2014 since i have set format as DD/MM/YYYY
I used below validation .
If Me.txtStartDate.Value = "" Then
MsgBox "Please enter Work Start Date."
Me.txtStartDate.SetFocus
Exit Sub
End If
If Not IsDate(Me.txtStartDate.Value) Then
MsgBox "The Work Start Date Field must be in DD/MM/YYYY format"
Me.txtStartDate.SetFocus
Exit Sub
End If
Ideally this is what i am expecting. Only valid date should be entered via Form. I use textbox to input date in DD/MM/YYYY Format. There are chances that user may enter 01/12/2014 or 1/12/2014 in dates. I mean leading zeros may be entered or not for DD & MM.
Please advice how i can handle this. How excel treats dates to store actually in which format .
How to calculate Period column in Years Months Days Format.
Thanks for the help .