D
daniroy
Hello there and thanks in advance for people that are gonna help!
At the beginning of my module, I define the following public variables
as I will need to use them in different calculations
______________________________________________________________
Public FirstFuture As Single
Public SecondFuture As Single
Public ThirdFuture As Single
Public FourthFuture As Single
______________________________________________________________
Then in the following Sub, I do define the value of this Public
Variables as follow
______________________________________________________________
Sub CalculateFuturesLevels()
Dim FirstFuture As Single
Dim SecondFuture As Single
Dim ThirdFuture As Single
Dim FourthFuture As Single
FirstFuture = (Sheets("FTSE").Range("C2").Value +
Sheets("FTSE").Range("D2").Value) / 2
SecondFuture = (Sheets("FTSE").Range("C3").Value +
Sheets("FTSE").Range("D3").Value) / 2
ThirdFuture = (Sheets("FTSE").Range("C5").Value +
Sheets("FTSE").Range("D5").Value) / 2
FourthFuture = (Sheets("FTSE").Range("C6").Value +
Sheets("FTSE").Range("D6").Value) / 2
Sheets("Implied Dividends").Range("R5") = FirstFuture
Sheets("Implied Dividends").Range("R6") = SecondFuture
Sheets("Implied Dividends").Range("R7") = ThirdFuture
Sheets("Implied Dividends").Range("R8") = FourthFuture
______________________________________________________________
Up to now everything is fine, and I now - maybe am I wrong - to be able
to retrieve these Public Variables as soon as I need them.
But unfortunatelly in the test sub
______________________________________________________________
Sub test()
Sheets("Implied Dividends").Range("Q15") = FirstFuture
End Sub
______________________________________________________________
I only retrieve "0" as if the variable "FirstFuture" is not stored at
all.
Am I expecting too much of Public Variable, am I on the wrong road or I
am missing something really obvious ? Why my variables are not stored ?
Many thanks for your help ...
best regards
Daniel
At the beginning of my module, I define the following public variables
as I will need to use them in different calculations
______________________________________________________________
Public FirstFuture As Single
Public SecondFuture As Single
Public ThirdFuture As Single
Public FourthFuture As Single
______________________________________________________________
Then in the following Sub, I do define the value of this Public
Variables as follow
______________________________________________________________
Sub CalculateFuturesLevels()
Dim FirstFuture As Single
Dim SecondFuture As Single
Dim ThirdFuture As Single
Dim FourthFuture As Single
FirstFuture = (Sheets("FTSE").Range("C2").Value +
Sheets("FTSE").Range("D2").Value) / 2
SecondFuture = (Sheets("FTSE").Range("C3").Value +
Sheets("FTSE").Range("D3").Value) / 2
ThirdFuture = (Sheets("FTSE").Range("C5").Value +
Sheets("FTSE").Range("D5").Value) / 2
FourthFuture = (Sheets("FTSE").Range("C6").Value +
Sheets("FTSE").Range("D6").Value) / 2
Sheets("Implied Dividends").Range("R5") = FirstFuture
Sheets("Implied Dividends").Range("R6") = SecondFuture
Sheets("Implied Dividends").Range("R7") = ThirdFuture
Sheets("Implied Dividends").Range("R8") = FourthFuture
______________________________________________________________
Up to now everything is fine, and I now - maybe am I wrong - to be able
to retrieve these Public Variables as soon as I need them.
But unfortunatelly in the test sub
______________________________________________________________
Sub test()
Sheets("Implied Dividends").Range("Q15") = FirstFuture
End Sub
______________________________________________________________
I only retrieve "0" as if the variable "FirstFuture" is not stored at
all.
Am I expecting too much of Public Variable, am I on the wrong road or I
am missing something really obvious ? Why my variables are not stored ?
Many thanks for your help ...
best regards
Daniel