Hi.
I have a working APR quotation system that uses Excel, dialog boxes and some basic VB. I would like to streamline the process by transferring the IRR function into VB but I am a complete novice. The following information is provided by the user:
loan (this is the first value used in the IRR function as a negative value)
term (number of months)
payments (these are the subsequent values used in the IRR function).
In all cases the term will be between 12 and 300 and the payments will be the same each month.
I picked up the following code from the Microsoft site but was wondering how I could adjust it to the example above.
[CODE=vb]Sub TestIRR()
Dim Guess, RetRate, Values(4) As Double
Dim Fmt, Msg As String
Guess = 0.1 ' Guess starts at 10 percent.
Fmt = "#0.00" ' Define percentage format.
Values(0) = -70000 ' Business start-up costs.
' Positive cash flows reflecting income for four successive years.
Values(1) = 22000 : Values(2) = 25000
Values(3) = 28000 : Values(4) = 31000
RetRate = IRR(Values, Guess) * 100 ' Calculate internal rate.
Msg = "The internal rate of return for these five cash flows is "
Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
MsgBox(Msg) ' Display internal return rate.
End Sub[/CODE]
Thanks for looking
Tina xx
I have a working APR quotation system that uses Excel, dialog boxes and some basic VB. I would like to streamline the process by transferring the IRR function into VB but I am a complete novice. The following information is provided by the user:
loan (this is the first value used in the IRR function as a negative value)
term (number of months)
payments (these are the subsequent values used in the IRR function).
In all cases the term will be between 12 and 300 and the payments will be the same each month.
I picked up the following code from the Microsoft site but was wondering how I could adjust it to the example above.
[CODE=vb]Sub TestIRR()
Dim Guess, RetRate, Values(4) As Double
Dim Fmt, Msg As String
Guess = 0.1 ' Guess starts at 10 percent.
Fmt = "#0.00" ' Define percentage format.
Values(0) = -70000 ' Business start-up costs.
' Positive cash flows reflecting income for four successive years.
Values(1) = 22000 : Values(2) = 25000
Values(3) = 28000 : Values(4) = 31000
RetRate = IRR(Values, Guess) * 100 ' Calculate internal rate.
Msg = "The internal rate of return for these five cash flows is "
Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
MsgBox(Msg) ' Display internal return rate.
End Sub[/CODE]
Thanks for looking
Tina xx
Comment