Taking multiple parameters

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?
 
B

Bernie Deitrick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top