View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
mark_varney47[_2_] mark_varney47[_2_] is offline
external usenet poster
 
Posts: 1
Default Linking VBA code to spreadsheet

Bradley/Tom or anyone else that can help,
This is the code that I am trying to link to my spreadsheet.

Public Function Range("B1").Value As String,Range("B2"). _
Value As Double,Range("B3").Value As Double,Range("B4"). _
Value As Double,Range("B5").Value As Double,Range("B6"). _
Value As Double) As Double

Dim1 d1 As Double, d2 As Double
d1=(Log(B2/B3)+(B6^2/2)*B4)/(B6*Sqr(B4))
D2=(D1-B6*Sqr(B4)

If B1="c" Then _
B7=Exp(-B5*B4)*(B2*CND(d1)-B3*CND(d2))
If B1="p" Then _
B7=Exp(-B5*B4)*(B3*CND(-d2)-B2*CND(-d1) _
ElseIf _

End Function

The values to be input into the spreadsheet are as follows:
B1=c
B2=3900
B3=3900
B4=0.5
B5=0.05
B6=0.25
B7=Blank as this is where the output should appear.


Any help with this would be gratefully appreciated.
Thanks,
Mark