I have the below code which opens two inputbox's individually for to/from dates to be entered to run a report. Currently if the cancel button is pressed it closes everything down and reopens my login userform. Is it possible to code the cancel button to load a specific userform instead? Thanks in advance.
VBA Code:
'Gets input boxes for to/from dates for report
1 ans1 = InputBox("Enter Start Date", "Admin Dashboard", "dd/mm/yyyy")
If ans1 = "" Then
Exit Sub
ElseIf IsDate(ans1) Then
startdate = CDate(ans1)
Else
MsgBox "Please enter a valid start date"
GoTo 1
End If
2 ans2 = InputBox("Enter End Date", "Admin Dashboard", "dd/mm/yyyy")
If ans2 = "" Then
Exit Sub
ElseIf IsDate(ans2) Then
enddate = CDate(ans2)
Else
MsgBox "Please enter a valid end date"
GoTo 2
End If