What is the spot rate for year 4 and year 5 using the programming language? Guid
ID: 652843 • Letter: W
Question
What is the spot rate for year 4 and year 5 using the programming language?
Guidelines
-Please use Excel from your computer.
-Please use language programming to solve the question.
-Please provide a code.
N Bond Term (Yr) YTM (Annual) PAR Spot rate PMT PV 1 0.50 3.00% $ 100.00 3.00% $1.50 $100.00 2 1.00 4.00% $ 100.00 4.01% $2.00 $100.00 3 1.50 5.00% $ 100.00 5.03% $2.50 $100.00 4 2 5.50% $ 100.00 ?? $2.75 $100.00 5 3 6.50% $ 100.00 ?? $3.25 $100.00What is the spot rate for year 4 and year 5 using the programming language?
Guidelines
-Please use Excel from your computer.
-Please use language programming to solve the question.
-Please provide a code.
Explanation / Answer
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("c:aaaaBook1.xlsx")
xlWorkSheet = xlWorkBook.Worksheets("sheet1")
'display the cells value B2
TextBox1.Text = (xlWorkSheet.Cells(4, 5).value)
'edit the cell with new value
xlWorkSheet.Cells(5, 5) = Val(TextBox1.Text) + 0.01
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.