GetADate from user.
Posted by Stuart Welsh on September 11, 2001 2:58 AM
When using the following VB code I'm getting the American date format returned. e.g. when the user keys in 12/02/2001 the VB code returns it 02/12/2001. I need the user to key in a date when promted and keep it in UK date format.
Code:
Sub GetADate()
Dim TheString As String
Dim RowNdx As Integer
Dim TheDate As Double
Dim cellValue As Variant
TheString = Application.InputBox("Enter your key date using the format dd/mm/yy to calculate service")
cellValue = TheString
If IsDate(TheString) Then
TheDate = DateValue(TheString)
Sheets("Sheet3").Select
ActiveSheet.Range("a1").Value = cellValue
Else
Sheets("Sheet1").Select
MsgBox "Invalid date. Try again using the format dd/mm/yy"
GetADate
End If
End Sub