View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Exit Sub from Main Sub

I don't know if I would recommend using End. Because using End will clear
any Public variables values, or close any userforms that he may want to
remain open. I would recommend using End if you want "absolutely everything"
to stop.
--
Cheers,
Ryan


"AB" wrote:

Just put 'End' before 'Exit Sub'.

If all you want is to stop the main procedure from running when a
specific condition is met and the 'Exit Sub' happens, then you can
just put 'End' before every 'Exit Sub' and it will terminate all
running subs.
e.g.:

Sub Main()
Call abc
Call def
End Sub

Sub abc()
...
End ' <- this 'End' stops every currently running sub (including
Main)
Exit sub
End sub

Sub def()
...
End ' <- this 'End' stops every currently running sub (including
Main)
Exit sub
End sub
.