problems38

返回 相关 举报
problems38_第1页
第1页 / 共18页
problems38_第2页
第2页 / 共18页
problems38_第3页
第3页 / 共18页
problems38_第4页
第4页 / 共18页
problems38_第5页
第5页 / 共18页
点击查看更多>>
资源描述
A B C D1234567VBA CodeSub Ex1Macro()MsgBox This is Line1 & Chr(10) & _This is Line2, vbAbortRetryIgnore + vbSystemModal, _This is the titleEnd SubE1234567A B C D123456789101112131415161718VBA CodeFunction BetterNewPV(CF, r, n)Dim i As IntegerDim TempTemp = 0For i = 1 To nTemp = Temp + CF / (1 + r) iNext iBetterNewPV = TempEnd FunctionSub PVCalc()Dim CF, r, nCF = InputBox(Enter the cash flow:, PV Calc, 100.00)r = InputBox(Enter the interest rate:, PV Calc, 0.1)n = InputBox(Enter the number of periods:, PV Calc, 5)MsgBox PV is: & BetterNewPV(CF, r, n), , PV CalcEnd SubE123456789101112131415161718A B C D1234567891011121314151617181920212223VBA CodeSub NewPVCalc()Dim CF, r, nCF = InputBox(Enter the cash flow:, _New PV Calc, 100.00)r = InputBox(Cash flow enterd: & CF & Chr(13) & _Enter the interest rate:, _New PV Calc, 10.00%)If Right(r, 1) = % Thenr = Val(Left(r, Len(r) - 1) / 100#Elser = Val(r)End Ifn = InputBox(Cash flow entered: & CF & Chr(13) & _Interest rate enterd: & _FormatPercent(r, 4) & Chr(13) & _Enter the number of periods:, _New PV Calc, 5)MsgBox PV is: & _FormatCurrency(BetterNewPV(CF, r, n), 3), _, New PV CalcEnd SubE1234567891011121314151617181920212223A B C1234567891011121314151617181920212223242526272829VBA CodeSub PmtCalculator()Dim r, n, Sum, Pmt, Temp, iSum = InputBox(Enter the sum of the loan, _Payment Schedule Calculator, 1000.00)n = InputBox(Sum is & Sum & Chr(13) & _Enter the numer of payments, _Payment Schedule Calculator, 5)r = InputBox(Sum is & Sum & Chr(13) & _Numer of payments is & n & Chr(13) & _Enter the interest rate, _Payment Schedule Calculator, 5.0%)If Right(r, 1) = % Thenr = Val(Left(r, Len(r) - 1) / 100#Elser = Val(r)End IfPmt = -Application.Pmt(r, n, Sum, 0)Temp = Sum of loan & Sum & Chr(13) & _Number of payments & n & Chr(13) & _Interest rate & FormatPercent(r, 4) & _Chr(13) & Chr(13) & Period & Chr(9) & _PaymentFor i = 1 To nTemp = Temp & Chr(13) & i & Chr(9) & PmtNext iMsgBox Temp, , Payment Schedule CalculatorEnd SubD1234567891011121314151617181920212223242526272829A B C123456789101112131415161718192021222324252627282930313233343536373839404142434445VBA CodeSub PmtCalculator1()Dim r, n, Sum, Pmt, Temp, i, rrSum = InputBox(Enter the sum of the loan, _Payment Schedule Calculator, 1000.00)n = InputBox(Sum is & Sum & Chr(13) & _Enter the numer of payments, _Payment Schedule Calculator, 5)r = InputBox(Sum is & Sum & Chr(13) & _Numer of payments is & n & Chr(13) & _Enter the interest rate, _Payment Schedule Calculator, 5.0%)If Right(r, 1) = % Thenr = Val(Left(r, Len(r) - 1) / 100#Elser = Val(r)End IfPmt = -Application.Pmt(r, n, Sum, 0)Temp = Sum of loan & Sum & Chr(13) & _Number of payments & n & Chr(13) & _Interest rate & FormatPercent(r, 4) & _Chr(13) & Chr(13) & _Period & Chr(9) & _Balance & Chr(9) & _Payment & Chr(9) & _Interest & Chr(9) & _Capital & Chr(9)For i = 1 To nrr = Sum * rTemp = Temp & _Chr(13) & _i & _Chr(9) & _FormatCurrency(Sum, 2) & _Chr(9) & _FormatCurrency(Pmt, 2) & _Chr(9) & _FormatCurrency(rr, 2) & _Chr(9) & _FormatCurrency(Pmt - rr, 2)Sum = Sum - Pmt + rrNext iMsgBox Temp, , Payment Schedule CalculatorEnd SubD123456789101112131415161718192021222324252627282930313233343536373839404142434445A B C123456789101112131415161718192021222324252627282930313233343536373839404142434445A B C464748495051VBA CodeSub PmtCalculator2()Dim r, n, Sum, Pmt, Temp, i, rr, NextStop, lngNextStop = FalseSum = InputBox(Enter the sum of the loan, _Payment Schedule Calculator, 1000.00)Pmt = InputBox(Sum is & Sum & Chr(13) & _Enter the of payment, _Payment Schedule Calculator, Sum / 5)r = InputBox(Sum is & Sum & Chr(13) & _Payment is & Pmt & Chr(13) & _Enter the interest rate, _Payment Schedule Calculator, 5.0%)If Right(r, 1) = % Thenr = Val(Left(r, Len(r) - 1) / 100#Elser = Val(r)End Iflng = Len(FormatCurrency(Sum, 2)Temp = Sum of loan & _FormatCurrency(Sum, 2) & _ & _Payment & _FormatCurrency(Pmt, 2) & _ & _Rate & FormatPercent(r, 4) & _Chr(13) & Chr(13) & _Period & Chr(9) & _Balance & Chr(9) & _Payment & Chr(9) & _Interest & Chr(9) & _Capital & Chr(9)For i = 1 To 999rr = Sum * rTemp = Temp & _Chr(13) & _i & _Pad10(Sum, lng) & _Pad10(Pmt, lng) & _Pad10(rr, lng) & _Pad10(Pmt - rr, lng)If NextStop Then Exit ForSum = Sum - Pmt + rrIf Pmt - Sum * r Sum ThenD123456789101112131415161718192021222324252627282930313233343536373839404142434445 Pmt = Sum * (1 + r)NextStop = TrueEnd IfNext iMsgBox Temp, , Payment Schedule CalculatorEnd SubD464748495051A B C123456789101112131415161718192021222324252627282930313233343536373839404142434445A B C46474849505152535455565758596061626364VBA CodeSub PmtCalculator3()Dim r, n, Sum, Pmt, Temp, i, rr, NextStop, lng, PmtrNextStop = FalseSum = InputBox(Enter the sum of the loan, _Payment Schedule Calculator, 10000.00)Pmt = InputBox(Sum is & Sum & Chr(13) & _Enter the of payment, _Payment Schedule Calculator, Sum / 5)r = InputBox(Sum is & Sum & Chr(13) & _Payment is & Pmt & Chr(13) & _Enter the interest rate, _Payment Schedule Calculator, 10.0%)If Right(r, 1) = % Thenr = Val(Left(r, Len(r) - 1) / 100#Elser = Val(r)End IfPmtr = InputBox(Sum is & Sum & Chr(13) & _Payment is & Pmt & Chr(13) & _Rate is & r & Chr(13) & _Enter payment rate of change, _Payment Schedule Calculator, 10.0%)If Right(Pmtr, 1) = % ThenPmtr = Val(Left(Pmtr, Len(Pmtr) - 1) / 100#ElsePmtr = Val(Pmtr)End Iflng = Val(Sum)Temp = Sum of loan & _FormatCurrency(Sum, 2) & _ & _Payment & _FormatCurrency(Pmt, 2) & _ & _Rate & FormatPercent(r, 2) & _ & _Payment rate & FormatPercent(Pmtr, 2) & _Chr(13) & Chr(13) & _Period & _Pad(Balance, lng) & _Pad(Payment, lng) & _Pad(Interest, lng) & _Pad(Capital, lng)D123456789101112131415161718192021222324252627282930313233343536373839404142434445 For i = 1 To 999rr = Sum * rTemp = Temp & _Chr(13) & _i & _Pad10(Sum, lng) & _Pad10(Pmt, lng) & _Pad10(rr, lng) & _Pad10(Pmt - rr, lng)If NextStop Then Exit ForSum = Sum - Pmt + rrPmt = Pmt * (1 + Pmtr)If Pmt - Sum * r Sum ThenPmt = Sum * (1 + r)NextStop = TrueEnd IfNext iMsgBox Temp, , Payment Schedule CalculatorEnd SubD46474849505152535455565758596061626364
展开阅读全文
相关资源
相关搜索
资源标签
网站客服QQ:736505653
中华第一财税网文库分网版权所有
粤ICP备15045937号