View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default keep track of last code line before error

Yes, I am using that one.

RBS

"John.Greenan" wrote in message
...
Download mz tools excel vba addin and it will add line numbers for you.
The
URL is something like www.mztools.com


--
www.alignment-systems.com


"Peter T" wrote:

Hi Bart,

Need Line numbers but no need to increment a variable.

Sub test()
On Error GoTo errH

10 x = x + 1
20 x = x + 2
30 x = x / 0
40 x = x + 1
x = x + 1
x = x / 0
50 x = x + 1

Exit Sub
60 x = 10

Exit Sub
errH:
If Erl = 30 Then
Resume Next
Else
MsgBox Erl
GoTo 60
End If
End Sub


Regards,
Peter T


"RB Smissaert" wrote in message
...
Is it possible somehow to keep track of the last line of code that was
run
before a handled error occured without
adding line numbers or without adding a public variable that gets
incremented before every line?
I was thinking of perhaps a class handling VBE events, but I think I
will
need the public variable.
I am not keen to add line numbers.

RBS