The code where I want to use what I asked is very long, I mean, I cant paste
it here, and oviously I don't want to use the on error goto....
I was thinking in a on error resume next but the next should mean the next
of the for, no the next line, How to accomplish this???
> I don't see anything in your code that should be causing an error, unless the
> cells don't contain numbers and you can check for that and avoid the error.
[quoted text clipped - 14 lines]
> > >
> > > on the basis that this is a limited loop it isn't too dangerous
Jim Thomlinson - 26 Jan 2006 18:01 GMT
You can essentially use Tony's code if you want. Place the on error goto
statement just ahead of the line(s) that will generate the error and
immediately after that put on error goto 0 which will reset the error
handler. You can also have multiple error handling routines if you want...
sub gtt()
on error goto AnError:
for a=1 to 10
cell(a,1)=cell(a,1)+cell(a,2)
cell(c,5)="Hola" ' if the line below is error DON'T go here
msgbox "Error en lo establecido " & cell(a,1) , vbokonly, "Error"
AnError:
next 'if error goto this next
On error goto MyError
'More code and stuff
Exit Sub
MyError:
msgbox "Whatever"
end sub

Signature
HTH...
Jim Thomlinson
> The code where I want to use what I asked is very long, I mean, I cant paste
> it here, and oviously I don't want to use the on error goto....
[quoted text clipped - 19 lines]
> > > >
> > > > on the basis that this is a limited loop it isn't too dangerous