M
mike allen
this is a very simple example of a much bigger pair of subs. i need to use
variables set in main sub w/in the called upon second sub. example:
Sub Macro1()
For i = 1 To 3
tabpick = "page " & i
Call macro2
Next i
End Sub
Sub macro2()
MsgBox "you are on " & tabpick
End Sub
it should result in a series of 3 msgbox's that say: 'you are on page 1',
'you are on page 2', 'you are on page 3'
is it possible for a called upon sub to remember the variable at hand
without re-establishing all my variables? these variables set in 1st sub
take up tons of code to calculate, so it is not feasible to re-calc every
time. also, the code in the 2nd and subsequent subs is quite involved. I
have thought about a function vs. sub, but the inputs are so many. any
other ideas? thanks, mike allen
variables set in main sub w/in the called upon second sub. example:
Sub Macro1()
For i = 1 To 3
tabpick = "page " & i
Call macro2
Next i
End Sub
Sub macro2()
MsgBox "you are on " & tabpick
End Sub
it should result in a series of 3 msgbox's that say: 'you are on page 1',
'you are on page 2', 'you are on page 3'
is it possible for a called upon sub to remember the variable at hand
without re-establishing all my variables? these variables set in 1st sub
take up tons of code to calculate, so it is not feasible to re-calc every
time. also, the code in the 2nd and subsequent subs is quite involved. I
have thought about a function vs. sub, but the inputs are so many. any
other ideas? thanks, mike allen