acotgreave
New member
- Local time
- Today, 19:28
- Joined
- May 18, 2005
- Messages
- 7
HI,
I'm trying to calculate a profit growth in one of my Reports.
My function is as follows.
When I call it with the following values I get a RunTime error 5 "Invalid Procedure Call":
If I replace the variables with the values, I still get the error:
However, if I replace the division calculations, I don't:
This is driving me crazy. The function works with other values, and I can't work out why these three values are causing me the problem.
Can anyone help me out. It's pretty urgent!
Thanks
I'm trying to calculate a profit growth in one of my Reports.
My function is as follows.
Code:
Private Function Rate(vStart As Variant, vEnd As Variant, vYears As Variant)
Rate = ((vEnd / vStart) ^ (1 / vYears) - 1)
End Function
When I call it with the following values I get a RunTime error 5 "Invalid Procedure Call":
Code:
vEnd = 1738206
vStart = -21430
vYears = 3
If I replace the variables with the values, I still get the error:
Code:
Rate = ((1738206 / -21430) ^ (1 / 3) - 1)
However, if I replace the division calculations, I don't:
Code:
Rate = -81.1108726084928 ^ -0.666666666666667
This is driving me crazy. The function works with other values, and I can't work out why these three values are causing me the problem.
Can anyone help me out. It's pretty urgent!
Thanks