appc
asked on
Error with custom VBA function
I get no error when I debug the function in VB but I get an error when I use the function...
Can someone help me?
Here is the code:
Function Amortization(Original As Double, Amort As Double, Months As Double, Rate As Double)
Dim Previous As Double
Dim Total As Double
Dim i As Integer
Previous = 0
For i = 1 To Months
Total = (Original - Amort * (i - 1)) / ((1 + Rate) ^ i) + Previous
Previous = Total
Next i
End
Amortization = Total
End Function
Can someone help me?
Here is the code:
Function Amortization(Original As Double, Amort As Double, Months As Double, Rate As Double)
Dim Previous As Double
Dim Total As Double
Dim i As Integer
Previous = 0
For i = 1 To Months
Total = (Original - Amort * (i - 1)) / ((1 + Rate) ^ i) + Previous
Previous = Total
Next i
End
Amortization = Total
End Function
when you get the error what is it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I get it in the spreadsheet:
#value!
#value!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Remove the single "End"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked. Thanks!