View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ppsa ppsa is offline
external usenet poster
 
Posts: 30
Default procedure too large

I think I understand your question, now. You can use either approach I showed
you above. In either case, you just call MyNewProc, so you're just making 1
call. MyNewProc then either calls the other procs, or starts the call chain
so that the next one calls the next one, and that calls the next one, etc.

"ppsa" wrote:

Well, if you split a procedure up, you're going to have to run the new ones
if you want the same result! You can do it in two ways:

Let's say that MyOriginalProc is the original procedure

Sub MyOriginalProc
statementblock1
statementblock2
statementblock3
End Sub

You can split it up like this:

Sub MyNewProc
statementblock1
MyNewProcA
End Sub

Sub MyNewProcA
statementblock2
MyNewProcB
End Sub

Sub MyNewProcB
statementblock3
End Sub

Or, you can do it like this:

Sub MyNewProc
MyNewProcA
MyNewProcB
MyNewProcC
End Sub

Sub MyNewProcA
statementBlock1
End Sub

Sub MyNewProcB
statementBlock2
End Sub

Sub MyNewProcC
statementBlock3
End Sub


"DB74" wrote:

how do you split a large procedure into two or more smaller procedures? I
put an End Sub statement, but then I need to run two seperate macros...is
there a better way so I only have to run 1?