Error Handling in VBA

Sub CheckError()

'On Error GoTo 0
'On Error Resume Next
On Error GoTo Handler:

Dim longResult As Long, longgInteger As Long
longInteger = InputBox("Enter Your Number")
longResult = longInteger + 3
MsgBox(longResult)

Exit Sub

Handler:
MsgBox("Not a Number")


End Sub
Previous
Next