Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Depends. It is particularly useful to set up a separate sub that can be
called by other subs if those other subs need to perform similar functions. If you have to ever make changes to the code, it is easier because you only have to do it once. For example, I have one template that has to perform a dozen or so different filter operations on a particular table. Instead of writing 12 filter procedures, I have one sub that actually performs the filtering. The other 12 pass parameters to it (filter criteria, etc) and perform any other procedures/setup that is specific to their own filter operation (one filter operation has to get user input, so it does that and passes the info along to the filter sub - but getting user input is specific only to that particular filter operation). I usually go with what appears organized and logical to me. Using additional subs can also help w/testing and debugging. You can set up some dummy data and a test macro that calls the sub you want to test/debug and step through it without having to run/step through one giant macro in order to test/debug only one particular part of it. OTOH I avoid setting up another sub when it would require too much duplicate work, or a lot of parameter passing, or require most of my variables to be declared at the module level. "MC82" wrote: Thanks for the explanation guys. What about the usage of "Call" Sub? Is this also something I should refrain from using much? -- MC82 ------------------------------------------------------------------------ MC82's Profile: http://www.excelforum.com/member.php...o&userid=18682 View this thread: http://www.excelforum.com/showthread...hreadid=540083 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
? IF & GOTO ? | Excel Worksheet Functions | |||
If.....Then GoTo....... | Excel Discussion (Misc queries) | |||
On Error Goto doesn't goto | Excel Programming | |||
On Error Goto doesn't goto | Excel Programming | |||
Goto next used row | Excel Programming |