I have a couple of colleagues looking at some bad code in Excel VBA, wondering is there a limit to the number of levels in a call stack
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unless the function is tail-recursive and VBA can handle that (which it can’t), you’ll run into a stack overflow.
As a simple test I hacked together the following snippet:
which tells us that the limit for this is 4007 iterations, at least in my version of Excel 2007 here.