Sub errorTest2()
Dim intNumerator As Integer
Dim intDenominator As Integer
Dim intResult As Double
On Error GoTo mytrap
intNumerator = InputBox("Please enter a numerator", "Numerator")
enterDenominator:
intDenominator = InputBox("Please enter a denominator", "Denominator")
intResult = intNumerator / intDenominator
msgBox "The result is " & intResult
Exit Sub
mytrap:
If Err.number = 11 Then
msgBox (Err.Source)
Else
msgBox ("Something else is going wrong")
End If
Resume enterDenominator
End Sub
|