Part 2
Add a new parameter to each Module as required
eg: using XCall7 as an example
Function XCall7(S As Double, Q As Double, r As Double, SDiv As Range, multifly As Double, T As Double, xRange As Range, OptQnt As Range, Optional SDivVar As Double = 0) As Double
Dim d1 As Double
Dim d2 As Double
Dim N1 As Double
Dim N2 As Double
Dim X As Double
Dim Counter1 As Double
Dim XCall_Here As Double
Counter1 = 0
XCall7 = 0
For X = 1 To xRange.Rows.Count
d1 = (Log(S / xRange.Cells(X)) + (r - Q + 0.5 * (SDiv.Cells(X) + SDivVar) * (SDiv.Cells(X) + SDivVar)) * T) / ((SDiv.Cells(X) + SDivVar) * Sqr(T))
d2 = d1 - (SDiv.Cells(X) + SDivVar) * Sqr(T)
N1 = Application.WorksheetFunction.Norm_S_Dist(d1, 0)
N2 = Application.WorksheetFunction.Norm_S_Dist(d2, 0)
Counter1 = Counter1 + 1
XCall_Here = (Exp(-Q * T) * S * N1 - Exp(-r * T) * xRange.Cells(X) * N2) * multifly * OptQnt(Counter1)
XCall7 = XCall7 + XCall_Here
Next
End Function
Then call the function as:
=XCall7(G2,$G$7,$G$6,$D$3:$D$33, $G$1,G5,$B$3:$B$33,$A$3:$A$33, 0.1)
or replace with a cell reference
=XCall7(G2,$G$7,$G$6,$D$3:$D$33, $G$1,G5,$B$3:$B$33,$A$3:$A$33,$G$8)
putting +/- 0.1 in G8
You can leave out the parameter and it will default to 0
=XCall7(G2,$G$7,$G$6,$D$3:$D$33, $G$1,G5,$B$3:$B$33,$A$3:$A$33)
is equivalent to:
=XCall7(G2,$G$7,$G$6,$D$3:$D$33, $G$1,G5,$B$3:$B$33,$A$3:$A$33,0)
you will have to make similar changes in the other Functions
also note, the line for d1 in the above code can be simplified as:
d1 = (Log(S / xRange.Cells(X)) + (r - Q + 0.5 * (SDiv.Cells(X) + SDivVar) ^ 2) * T) / ((SDiv.Cells(X) + SDivVar) * Sqr(T))