I have some macro code which does a number of things, but for one sections I am calling a Sub from another module. Both the Sub in the other module and the main macro code contain the variable r dimmed as long. I am assigning a value to r in the main macro code, and I want that value to be assigned to r in the sub in the other module as well.
I have the code written like this:
And I have the Sub in the other module written like this:
I know this isn't written right, but I want the SubFromOtherValue to automatically take the value for r and x from the main body of code.
If anyone could help me out with this I would be greatly appreciative. Thanks for the looks!
Hank
I have the code written like this:
Code:
Sub MainMacro()
Dim r As Long
Dim x As Long
r = 8
Do While r < 250
Call SubFromOtherModule
r = r + 8
Loop
r = 258
Do While r < 498
Call SubFromOtherModule
r = r + 8
Loop
End Sub
And I have the Sub in the other module written like this:
Code:
Sub SubFromOtherModule()
Dim r As Long
Dim x As Long
Run Code
End Sub
I know this isn't written right, but I want the SubFromOtherValue to automatically take the value for r and x from the main body of code.
If anyone could help me out with this I would be greatly appreciative. Thanks for the looks!
Hank