View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Please let me know the error in this code

On Feb 17, 2:52*am, vbaseeker wrote:
Please let me know the error in this code with syntax
error in function line.

[....]
Sub Montecarlo()

Function callPriceMC(s0 As Double,k As Double, T As Double,r As
Double, q As Double, vol As Double,
numTrials As Long, seed As Long) As Double

[....]
*End Function

End Sub


You cannot nest procedures -- you cannot put a function inside a sub.

Simply remove the lines Sub Montecarlo() and End Sub.

But I did not bother read, much less test, the function itself to see
if there are other errors. I simply confirmed that removing the sub-
related lines eliminates all syntax errors, after I correct the lines
folded in the posting without continuation characters.