Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am new to VBA..i wrote the following code..it basically take 5
variables and use as imputs for a a formula. i won't work for me..can someone help see what is wrong. Thanks for your help! Option Explicit Private Sub CommandButton1_Click() Dim Spot As Double Dim strike As Double Dim RF As Double Dim Vol As Double Dim YTM As Double Dim Call_PX As Variant Dim d1 As Variant Dim d2 As Variant Dim CallPx As Variant On Error GoTo EndMacro Spot = ActiveCell.Range("B12").Value strike = ActiveCell.Range("B13").Value RF = ActiveCell.Range("B14").Value YTM = ActiveCell.Range("B15").Value Vol = ActiveCell.Range("B16").Value d1 = (Log(Spot / strike) + (RF + (0.5 * Vol ^ 2)) * YTM) / (Vol * YTM ^ 0.5) d2 = d1 - Vol * YTM ^ 0.5 CallPx = Spot * WorksheetFunction.NormSDist(d1) - strike * Exp(-RF * YTM) * WorksheetFunction.NormSDist(d2) Range("B18").Value = CallPx EndMacro: End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Debug on userform | Excel Discussion (Misc queries) | |||
DeBug | Excel Discussion (Misc queries) | |||
help with debug | New Users to Excel | |||
Row deletion debug | Excel Programming | |||
debug help | Excel Programming |