View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default On Error GoTo : How to use multiple?

Tom Ogilvy provided some code to avoid your problem. Nevertheless, I
have inserted some code in your originally provided code to illustrate
one way to have multiple On Error statements executed. You need to
resume execution (i.e., exit the error handler) after entering each
error handler.

Alan Beban

e18 < wrote:

I wan't to use multiple On Error GoTo commands, but If one error appear,
the next error results in Run-time error 91. Do I have to reset
something after each check (...and in case, what?)?

Thanks, Erlend


Dim test1, test2, test3

Sub checkk()

Dim test1, test2, test3
test1 = False
test2 = False
test3 = False

'check1:
On Error GoTo check2
Columns("B").Find(What:="length").Activate
test1 = True

check2:

Resume insert2
insert2:Err.Clear
On Error GoTo check3
tab1start = Columns("A").Find(What:="md").Row
test2 = True

check3:

Resume insert3
insert3:Err.Clear
On Error GoTo stopp
tab2start = Columns("B").Find(What:="east").Row
test3 = True

stopp:
If Not test3 Then
MsgBox "Unknown format"
Exit Sub
End If

End Sub


---
Message posted from http://www.ExcelForum.com/