Hi,
I've written my first code that will require user's input of a date. I want to format the date to be shown in a cell as "dd/mm/yyyy". Everything works but the output is showing as mm/dd/yyyy. Can anybody help me please?
I've written my first code that will require user's input of a date. I want to format the date to be shown in a cell as "dd/mm/yyyy". Everything works but the output is showing as mm/dd/yyyy. Can anybody help me please?
Code:
Sub inputSettlementDate()
Dim varInputDate As Variant
Dim lngERow As Long
varInputDate = InputBox("Please enter the Settlement Date", "Settlement Date", "dd/mm/yyyy")
If IsDate(varInputDate) Then
varInputDate = Format(varInputDate, "dd/mm/yyyy")
lngERow = Range("B" & Rows.Count).End(xlUp).Row + 1
Range("B" & lngERow).Value = varInputDate
Else
MsgBox "Please enter a valid date format dd/mm/yyyy"
varInputDate = InputBox("Please enter the Settlement Date using this format dd/mm/yyyy.", "Settlement Date")
End If
End Sub