Not really sure if this the right place to ask an _Excel_ VBA question, but here we go anyway:
I have to debug a macro code in a huge excel file which triggers some cascaded function calls. The first parameter of the function calls is always a Worksheet, as in:
Function ( sheet As Worksheet, bla...)
So after a few cascades, Excel raises the error that the stack is full.
Two questions:
1. Does another local copy of the worksheet gets created by each cascaded function call (this is my assumption why the overflow occurs), or does Excel use calls by reference anyway ?
2. If yes, what is the best way to fix that:
a. Use ByRef (But will the modification made to the worksheet by a function call remain when the function is left ?)
b. Pass the name of the worksheet instead of the worksheet itself ?
c. Another option ?
Thanks,