|
-
Mar 17th, 2006, 04:58 AM
#1
Thread Starter
New Member
Sub to put generated values in workbook...
hi there,
Im having some trouble here. The code is not doing what i want it to do. The code again:
If verti = "Option price" And hori = "Time to exercise" And asset = "Equity" And choice = "call" Then
For i = 1 To 10
'j = 2
t_m = t + i
Worksheets("workings").Cells(j + 1, j).Value = t_m
a = Log(s / x)
b = (r - q + (0.5 * (sd ^ 2))) * t_m
c = sd * (t ^ 0.5)
d1 = (a + b) / c
d2 = d1 - sd * (t_m ^ 0.5)
Call_Eur = (s * Exp(-q * t_m) * Hcumnorm(d1)) - (x * Exp(-r * t_m) * Hcumnorm(d2))
Worksheets("workings").Cells(j, j + 1) = Call_Eur
Next i
'Worksheets("workings").Cells(j + 1, j).Value = t_m
'Worksheets("workings").Cells(j + 1, j + 1) = Call_Eur
End If
This code is supposed to generate t_m and each time, store it in a cell in my worksheet "workings". Then, it should use the generated value of t_m and calculate Call_Eur, and each time, put the value generated in my worksheet alongside the generated values of t_m.
But it's not!...I don't know why either. I have made a lot changes but it is still not working.
Would you have any idea why?
Alvin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|