Hi All.
I have a problem. Actually I have found the solution to it but I don't understand why my original code wasn't working...
Here it is. It changes my inputdate "dd/mm/yyyy" to "mm/dd/yyyy"... When I use CDate then it works...
The code is to be used by different users. How do I avoid that the different language settings on each computer maintaine the date format "dd/mm/yyyy"?
Sub input_date()
Dim UserEntry_end As String
Dim dd As Date
Dim Msg_end As String
Msg_end = "Enter end date as dd/mm/yyyy"
UserEntry_end = ""
Do Until IsDate(UserEntry_end) And (Len(Trim(UserEntry_end)) = 10) And (Len(Trim(UserEntry_end)) >= 8)
UserEntry_end = InputBox(Msg_end)
If IsDate(UserEntry_end) And (Len(Trim(UserEntry_end)) <= 10) And (Len(Trim(UserEntry_end)) >= 8) Then
ActiveSheet.Range("C4").Value = Format(UserEntry_end, "dd/mm/yyyy")
' ActiveSheet.Range("C4").Value = CDate(UserEntry_end)
Exit Do
ElseIf UserEntry_end = "" Then
Exit Do
Else
Msg_start = "Please try again. Enter date as dd/mm/yyyy"
End If
Loop
End Sub
Best regards
Bookmarks