View Single Post
  #5   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

Hi again,

The other, more important drawback of line numbers is that when you remove
all formatting and comments from
the code to keep the filesize down the line numbers will prevent the leading
tabs being cleared, so the file size
will be a lot bigger. This is apart from the space taken by the linenumbers
themselves.

RBS

"Peter T" <peter_t@discussions wrote in message
...
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