January 15th, 2006, 8:23 pm
I have the following function to calculate the price of a Call option. It s written in a Modul. The main problem is everytime I am creating a new spreadsheet, i have to copy all the code in it.Is there a way to have this function to be called by any spreadsheet ? Thus, having a central VB code page, updated for all SpreadsheetsFunction Call_Eur(S, X, T, r, rf, vol) Dim a1 As Single Dim b1 As Single Dim c1 As Single Dim d1 As Single Dim d2 As Single a1 = Log(S / X) b1 = ((r - rf) + (0.5 * vol ^ 2)) * T c1 = vol * (T ^ 0.5) d1 = (a1 + b1) / c1 d2 = d1 - vol * (T ^ (0.5)) Call_Eur = (S * Exp(-rf * T) * Snorm(d1) - X * Exp(-r * T) * Snorm(d2))End Function