View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Error handling in macro

Instead of error handling, how about a validation loop early in the
code. This requires valid input before proceeding, and loops until a
numeric (that is to say, a date) value is entered:

Dim UserInput
Do
UserInputLoop:
If Not IsNumeric(Range("a1").Value) Then
UserInput = Inputbox("Please enter a valid date: ")
range("a1").value = UserInput
Goto UserInputLoop:
End If
Loop until IsNumeric(Range("a1").Value)

Constructive criticism: I notice this line has a typo in it: "Exprired"
MsgBox "Check Driver's License Expiration Date", 48, "Exprired Driver's

License"