View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default How do I come back to my First Sub?

Way back when I first learnt programming it was considered best practice to
have a controlling routine and as much as possible call all subs from the
controlling routine and return to the controlling routine to call the next
sub otherwise you get what was referred to as spagetti programming.

The only reason to call another sub from a sub that has been called is to
perhaps do some data validation or similar that is required from lots of
places within the project and it should return to the calling routine and
then back to the master control routine. You should have a good reason to go
more than 2 deep in the calls.

Example:
Sub First()
1.row
Call Second
Call Third
3.row
End Sub

Sub Second()
1.row
3.row
End Sub

Sub Third()
1.row

--
Regards,

OssieMac


"hannu" wrote:

Hi. I have two subs and I want to do this:


Sub First()
1.row
Call Second
3.row
End Sub

Sub Second()
1.row
Call Third
3.row
End Sub

Sub Third()
1.row
I would like to go to First Sub right after the Call Second row, but
not to execute 3.row from the Second sub
End Sub