These methods of calling a procedure do not allow you to pass an argument to the procedure. You have written all of these functions to require an argument. As TMS suggests, you need a master Sub() procedure to call these functions with an appropriate argument, or you need to call these functions from a spreadsheet cell to pass an appropriate argument. Examples
or in a spreadsheet cell =iteration(24). In order to enter debug mode, you will need to set a breakpoint somewhere in the function, so that the function will pause and let you inspect what is happening.
I note that you have v dim'ed twice in iteration -- once in the DIM statement and once in the function's argument list. I cannot remember for certain, but that may cause an error. You may also have issues with the scope of the various z and k variables, as they appear to only be dimensioned for the iteration procedure, but may not carry their values over to the other functions called by iteration.
I tend to prefer to code something like this as a UDF, so that I can call the function from the spreadsheet. With that in mind, I suggest a few pages for research and review:
http://www.cpearson.com/Excel/Writin...ionsInVBA.aspx
http://www.cpearson.com/Excel/DebuggingVBA.aspx
http://www.cpearson.com/Excel/Writin...ionsInVBA.aspx
Bookmarks