Hi. I need to use a result from a variable of another sub (sometimes from an another module). I tried using an analogy of userforms method i.e. On userform2:
MyVariable= userform1.textbox1.value (That's OK)
but on sub2 (where MyFirstVariable exists and it have been already calculated):
MySecondVariable=sub1.MyFirstVariable (Wrong!)
this doesn't work on sub's so How can I use variable result from sub 1 on sub 2 (without linking result with a worksheet cell).
Thx!

Exporting variables
mu2
Hi
If I understand your question correctly you want to use a variable from one sub routine in another. The best approach would be to pass the variable as a parameter. Eg the below takes a variable from Sub1, and Sub2 prints it to the immediate window.
Public Sub1
Dim x as long
x=1000
call sub2(x)
end sub
Public Sub2(MyVar as long)
debug.print MyVar
end sub
Gumbatman
In sub2:
MySecondVariable=[Forms]![userform1]![Textbox1]
It refers to the contents of the control [textbox1] in the form [userform1]
Good luck~
lunaa