Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Error 1004) Object Defined Error ...simple code Robert Crandal Excel Programming 1 January 12th 10 10:31 PM
Problem with code (error code 9) Vince Excel Programming 3 October 12th 09 04:16 PM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 07:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"