We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Error with custom VBA function

appc
appc asked
on
Medium Priority
405 Views
Last Modified: 2012-05-11
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
Comment
Watch Question

Commented:
when you get the error what is it?
omgangIT Manager
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I get it in the spreadsheet:

#value!
omgangIT Manager
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
Remove the single "End"
IT Manager
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
It worked. Thanks!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.