View Single Post
 
Old 04-04-2022, 07:13 AM
Debaser's Avatar
Debaser Debaser is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

I would handle the first three separately with a temp variable:

Code:
tempInput = InputBox("Enter the date the payment is due in format dd/mm/yyyy")
If tempinput = "" then exit sub
on error resume next
DueDate = CDate(tempinput)
on error goto 0
if duedate = 0 then 
   msgbox "Invalid date entered - please try again"
   exit sub
end if
You could also put the validation in a loop (with a counter so it's not infinite) so that it prompts to try again if an invalid date is entered.
Reply With Quote