Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moidule Line # continued
OK. Alex and Geof were very helpful - thanks. However, the next logical
step would then be able to 'GoTo' Erl. To simply code GoTo Erl produces an missing label error. This is not critical but, how then would one have a jump to that line after anouncing it's presence? Again, just curious. TIA doco |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moidule Line # continued
Don
something like: Sub Test() ' code GoTo ErrL ' code MsgBox "don't get here" ' code ErrL: MsgBox "but do get here" End Sub Note the colon after the label Regards Trevor "Don Cossitt" wrote in message ... OK. Alex and Geof were very helpful - thanks. However, the next logical step would then be able to 'GoTo' Erl. To simply code GoTo Erl produces an missing label error. This is not critical but, how then would one have a jump to that line after anouncing it's presence? Again, just curious. TIA doco |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moidule Line # continued
Yes I understand how to label a line. But if, in this case I desire to
'GoTo' a line number - not labeled. Eg. Public Sub TestError() Dim lErr As Long 10 On Error GoTo EH 20 lErr = 1 / 0 30 On Error GoTo 0 40 Exit Sub EH: 50 MsgBox "Error " & err.Number & vbCr & _ err.Description & " in line " & Erl, vbInformation, "TestError" GoTo Erl ' this part... how would one jump to the offending line? Again, just curious - probably wouldn't do it actually. End Sub "Trevor Shuttleworth" wrote in message ... Don something like: Sub Test() ' code GoTo ErrL ' code MsgBox "don't get here" ' code ErrL: MsgBox "but do get here" End Sub Note the colon after the label Regards Trevor "Don Cossitt" wrote in message ... OK. Alex and Geof were very helpful - thanks. However, the next logical step would then be able to 'GoTo' Erl. To simply code GoTo Erl produces an missing label error. This is not critical but, how then would one have a jump to that line after anouncing it's presence? Again, just curious. TIA doco |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moidule Line # continued
Don,
Never use Goto in an error handling block of code. Instead, use Resume to go to the line that cause the error, or Resume Next to go to the line following the line that caused the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Don Cossitt" wrote in message ... Yes I understand how to label a line. But if, in this case I desire to 'GoTo' a line number - not labeled. Eg. Public Sub TestError() Dim lErr As Long 10 On Error GoTo EH 20 lErr = 1 / 0 30 On Error GoTo 0 40 Exit Sub EH: 50 MsgBox "Error " & err.Number & vbCr & _ err.Description & " in line " & Erl, vbInformation, "TestError" GoTo Erl ' this part... how would one jump to the offending line? Again, just curious - probably wouldn't do it actually. End Sub "Trevor Shuttleworth" wrote in message ... Don something like: Sub Test() ' code GoTo ErrL ' code MsgBox "don't get here" ' code ErrL: MsgBox "but do get here" End Sub Note the colon after the label Regards Trevor "Don Cossitt" wrote in message ... OK. Alex and Geof were very helpful - thanks. However, the next logical step would then be able to 'GoTo' Erl. To simply code GoTo Erl produces an missing label error. This is not critical but, how then would one have a jump to that line after anouncing it's presence? Again, just curious. TIA doco |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Average With < Continued | Excel Worksheet Functions | |||
Excel Function . . . Continued | Excel Discussion (Misc queries) | |||
Median continued | Excel Discussion (Misc queries) | |||
If then statement continued! | Excel Discussion (Misc queries) | |||
continued help needed | Excel Programming |