View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default return from subroutine

Hi Chris,

Try changing the line:

if x 100 then return
To:
if x 100 then exit sub

---
Regards,
Norman

"inquirer" wrote in message
...
I have a program which calls a subroutine which in turn calls another
subroutine as in this schematic..

main program
call suba(z)
end
sub suba(z)
some code
call subb(x)
more code
end sub

sub subb(x)
some code
if x 100 then return
more code
end sub

When x 100 in subb, the progam returns to the main program and not to
suba.

Can someone tell me what I am doing wrong please?

Thanks
Chris