I am building a more complex report and since there are lots of repetive subs I want to structure them into different modules. However I experience empty values for some weird reason. (My question is more detailed written in "Module 3")
In this example I could have solved it by setting Public const x = 2.
But... since both the X and Y value is going to be calculated I find no other solution than to put them on subroutines and calculate it from there.
I am using Microsoft Excel 2010.
I hope you can help me out!
In this example I could have solved it by setting Public const x = 2.
But... since both the X and Y value is going to be calculated I find no other solution than to put them on subroutines and calculate it from there.
I am using Microsoft Excel 2010.
Code:
'In Module 3
Sub ExcecutionSub()
ValueSub1
ValueSub2
Debug.Print "The X value goes fine; " & x
Debug.Print [B]"X and Y go together in debug.print:[/B] "; x & y
[B]'''But look when I try it in a msgbox. Only X is visible[/B]
MsgBox x, q
End Sub
Code:
'in Module1
Public y As Long
Sub ValueSub1()
y = 2
End Sub
Code:
'in Module2
Public x As Long
Sub ValueSub2()
x = 8
End Sub
I hope you can help me out!