Taking multiple parameters

  • Thread starter Thread starter Tangier
  • Start date Start date
T

Tangier

I am running a query inside my macro that creates a worksheet full of
some info. I want users to be able to take the results of one macro,
and use it as arguments for another macro. So lets say I run 1 macro,
I get 2 user ids as a result, say: 1, 2

Now I want to use these user ids as input parameters. Keep in mind
these input parameters might vary.

So how do I supply these as parameters to another macro?
 
Pass the calculated or retreived values as parameters to the second macro:

Sub Macro1()
IDValue1 = "ID 123"
IDValue2 = "ID 456"
Macro2 IDValue1, IDValue2
End Sub

Sub Macro2(varVal1 As Variant, varVal2 As Variant)
MsgBox "I just got the values " & varVal1 & " and " & varVal2
End Sub

HTH,
Bernie
MS Excel MVP
 
Back
Top