Setting Up Black Scholes in a userform

Опубликовано: 14 Март 2026
на канале: Brian Byrne
2,769
8

Userform and Black Scholes
VBA Macro code snippets below:
https://sites.google.com/view/vinegar...






Private Sub CommandButton1_Click()
Unload UserForm1
End Sub

Private Sub CommandButton2_Click()
d1 = (Log(S / k) + (r - q + 0.5 * Sigma * Sigma) * T) / (Sigma * Sqr(T))

d2 = d1 - Sigma * Sqr(T)

N1 = Application.NormSDist(d1)

N2 = Application.NormSDist(d2)

Black_Scholes_Call = Exp(-q * T) * S * N1 - Exp(-r * T) * k * N2
End Sub

Private Sub CommandButton3_Click()
d1 = (Log(S / k) + (r - q + 0.5 * Sigma * Sigma) * T) / (Sigma * Sqr(T))

d2 = d1 - Sigma * Sqr(T)

N1 = Application.NormSDist(-d1)

N2 = Application.NormSDist(-d2)

Black_Scholes_Put = Exp(-r * T) * k * N2 - Exp(-q * T) * S * N1
End Sub