J
johnboy
Hi all,
I have a userform with two textboxes - one to enter a start date. The other
shows the calculated end date from textbox1 change event.
However, my code is not producing the required result (entered date + 12
months) I would be grateful if some kind person could assist and correct the
problem please.
Private Sub HolStartTextBox_Change()
Dim startdate As Date, enddate As Date
On Error Resume Next
startdate = CDate(HolStartTextBox.Text)
enddate = Year(startdate) & "/" & Month(startdate) + 12 & "/" & Day(0)
If IsDate(startdate) = True Then
HolEndTextBox.Text = Format(enddate, "dd/mm/yyyy")
End If
On Error GoTo 0
End Sub
I have a userform with two textboxes - one to enter a start date. The other
shows the calculated end date from textbox1 change event.
However, my code is not producing the required result (entered date + 12
months) I would be grateful if some kind person could assist and correct the
problem please.
Private Sub HolStartTextBox_Change()
Dim startdate As Date, enddate As Date
On Error Resume Next
startdate = CDate(HolStartTextBox.Text)
enddate = Year(startdate) & "/" & Month(startdate) + 12 & "/" & Day(0)
If IsDate(startdate) = True Then
HolEndTextBox.Text = Format(enddate, "dd/mm/yyyy")
End If
On Error GoTo 0
End Sub