I have a very simple macro in an Excel sheet, to allows users to recalculate.
I have no other macros/code in the workbook, and only this work book open
Sub Calculate() Calculate
End SubThis is activated by a button.
However, when pressed I get two error boxes, see image.
What does Out of stack space mean ?
And how do I resolve this issue ?
I have looked on this website:
It says I may have too many funtions ?? This macro used to work fine, and it is hardly doing a lot so cannot understand the issue.
I am able to calculate the sheet using the option under the formulas tab.
42 Answers
The function you have define is recursive, calling itself unconditionally until the stack is filled with all the calls.
You should change the name of your subroutine, eg:-
Sub Calc() Calculate
End SubIf you link Calc() to the button, you avoid any recursion.
You're calling Calculate inside of Calculate. Every call to Calculate causes another call to Calculate, which will then call Calculate... Then eventually you get that error when the stack fills up.
3