-
Passing Array Issues
Hi,
Please could you help?
I have the following program
[VBA]
Sub MyProgram1()
dim RefWeights() as variant
'code goes in here
Sub Myprogram2()
dim RefReturns(), dim LossParam()
LossParam(x) = RefReturns(x)*RefWeights(x)
'code goes in here
end sub
[/VBA]
As you can see from the above, RefWeights array was filled in the first sub routine, is there a way i can modify my code so that the contents of the Refweights array are available to use in the second sub routine?
Thanks for your help.
-
[vba]
dim RefWeights() as variant ' before all subs
Sub MyProgram1()
'code goes in here
end sub
Sub Myprogram2()
dim RefReturns(), dim LossParam()
LossParam(x) = RefReturns(x)*RefWeights(x)
'code goes in here
end sub
[/vba]
-
2 illustrations: passing to a function, passing to a sub
[VBA]Sub tst()
MsgBox sum_snb(Array(3, 5, 7, 9))
sub_snb Array(3, "text", Date, 9)
End Sub[/VBA]
[VBA]Function sum_snb(sn)
sum_snb = Application.Sum(sn)
End Function[/VBA]
[VBA]Sub sub_snb(sn)
For Each it In sn
MsgBox it
Next
End Sub[/VBA]
-
You guys are simply great!!!
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules