Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I come back to my First Sub?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I come back to my First Sub?
You should stick on to the main procedure and call Proc2 and Proc3 from Proc1
itself. Sub routines should be written only if you have a repetitive task. For making sub procedures more flexible you can pass arguments.. If this post helps click Yes --------------- Jacob Skaria "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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I come back to my First Sub?
If you are looking to get back to 'First Sub' based on a condition then use
Exit sub before row3.. IF <condition = True then Exit Sub If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: You should stick on to the main procedure and call Proc2 and Proc3 from Proc1 itself. Sub routines should be written only if you have a repetitive task. For making sub procedures more flexible you can pass arguments.. If this post helps click Yes --------------- Jacob Skaria "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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I come back to my First Sub?
Sub First()
Second() Third() End Sub to be honest, I didn't get the question. "hannu" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
back ups | Excel Discussion (Misc queries) | |||
copy back macro/roll back | Excel Worksheet Functions | |||
I hid row 1 and can't get it back? | Excel Discussion (Misc queries) | |||
Jon - come back | Charts and Charting in Excel | |||
Back Up | Excel Programming |