OK, this is driving me nuts. I have a simple function I want to call from a VBA module. Below is the code:
Public Sub CGDTest()
Dim LowPct As Double, LowDeduct As Double
LowPct = 15.9
LowDeduct = CalcLowDeduct(LowPct)
End Sub
Function CalcLowDeduct(LowPct As Double)
LowDeduct = Round((1.349907 * Log(LowPct) + 0.224636 * Log(LowPct) ^ 2 - 0.008581 * Log(LowPct) ^ 3), 2)
End Function
Anyhow, the LowDeduct correctly calculates to 5.27 within the function. However, upon my return to the module, the LowDeduct value changes to 0. What am I doing wrong? Thanks in advance for any help.
Public Sub CGDTest()
Dim LowPct As Double, LowDeduct As Double
LowPct = 15.9
LowDeduct = CalcLowDeduct(LowPct)
End Sub
Function CalcLowDeduct(LowPct As Double)
LowDeduct = Round((1.349907 * Log(LowPct) + 0.224636 * Log(LowPct) ^ 2 - 0.008581 * Log(LowPct) ^ 3), 2)
End Function
Anyhow, the LowDeduct correctly calculates to 5.27 within the function. However, upon my return to the module, the LowDeduct value changes to 0. What am I doing wrong? Thanks in advance for any help.