Excel: Formulas with variables stored in different models return all values as zero


Hello, I have a fairly complex mathematical model where variables and its value are currently stored in three modules. If I use a formula where the variables are stored in the same module, the formula will return the correct value. However, if I call up a value from a different module to module 3, the formula will always return a value of 0. For example, in module 1, I have executed the procedure: PotentialWagesGroup1 = 750 Worksheets(1).Range("D10").Value = PotentialWagesGroup1 In module 2 FullTimeWagesGroup1Year1 = GrowthRate ^ 0 * PotentialWagesGroup1 Worksheets(1).Range("J3").Value = FullTimeWagesGroup1Year1 Then in module 3 BeforeTaxIncomeGroup1Year1 = FullTimeWagesGroup1Year1 Worksheets(1).Range("Z71").Value = BeforeTaxIncomeGroup1Year1 All variables in this example are declared as public variables as double Cell D10 reads 750 Cell J3 reads 750 but Cell Z71 reads 0 This is just one example of many tests I've done. In all cases Cell Z71 reads 0. I've done a test in module 3 to see if variables stored only in that module also return a 0 value. Dim Test As Double Test = 20 Dim ProductTest ProductTest = Test * 2 Worksheets(1).Range("Z72").Value = ProductTest Cell Z72 reads 40, which is correct. Anyone have an idea what the problem is?


This question generated 9 answers. To proceed to the answers, click here.

This thread is current as of October 11, 2014.


For more resources for Microsoft Excel