I have recently encountered an On Error problem in an Excel2000 application. In this appl, data is entered several times within a looping structure. The data should be numeric, but could be a mix of alpha and numeric (user input error). I have an On Error GoTo ErrorHandler line that directs execution to the ErrorHandler section where the problem is digested, an error message presented, execution directed to the line where input occurs (a few lines above where the problem happened) for new input. The code works fine for the first error. But if a second error occurs, the On Error does not trigger.

I wrote a simple test routine. It spits out an error message for the first "bad input", but fails if bad input occurs again.

Sub TestOnError()
Dim X As Single
    Dim strBuffer As String
GetNum:
    strBuffer = InputBox("enter value for X")
    If strBuffer = "end" Then Exit Sub
    On Error GoTo ErrorHandler
    X = strBuffer
    MsgBox Str(X)
    GoTo GetNum
ErrorHandler:
    MsgBox "Error: input contains non-numerics", vbCritical
    GoTo GetNum
  ' Resume Next
End Sub
If I use the Resume Next line in the ErrorHandler section instead of the GoTo GetNum, I get the old value for X (understandably) and the proc marches on.

I have read through the On Error material in VBA Help and in a few VB manuals, but can find nothing about not triggering the 2nd time.

What is happening here?

Thanks