Example 9.4—Merging Lists Sub Control Subs can other subs and pass arguments “call” back and forth. This is very useful for modularizing programs, which makes it easier to use certain modules in completely different programs. Calling Subs To call (run) another sub, use the Call command. Once finished, control will return to the original Sub. Ex: Sub Main() Call CalcCost MsgBox finished!” “I’m End Sub Global vs. Local Variables A variable defined within a Sub is “local” (otherwise known as that is, it is only “Private”), recognized within that particular Sub. To have a variable be recognized in multiple Subs, it should be defined as otherwise known “global,” as To define a variable as global, “Public”.
Example 9.4—Merging Lists Sub Control Subs can “call” other subs and pass arguments back and forth. This is very useful for modularizing programs, which makes it easier to use certain modules in completely different programs. Calling Subs To call (run) another sub, use the Call command. Once finished, control will return to the original Sub. Ex: Sub Main() Call CalcCost MsgBox “I’m finished!” End Sub Global vs. Local Variables A variable defined within a Sub is “local” (otherwise known as “Private”), that is, it is only recognized within that particular Sub. To have a variable be recognized in multiple Subs, it should be defined as “global,” otherwise known as “Public”. To define a variable as global,
MgtOp-556-Topic-1-Set-4.docx