Out of Stack Space Error (Error No-28)

sachin kulkarni

New Member
Joined
May 21, 2009
Messages
4
Hello everyone!!:)

Can anyone plz help me with this problem?
I am calling a particular procedure in VB Excel repeatedly from a another procedure.
After some time the excel hangs up and stops responding. It shows "Out of Stack Space Error"

Is there a way to clear the stack space? Is ther any other solution?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
probably a good idea to show the code. There are any number of things you could be doing that could cause this.

Usually creating more and more variables... or expanding the variables...

Or not closing objects...
 
Upvote 0
Thanks Makrini for your response.


The code is like this..

'----------

For i=1 to 76

Range("H1")=i

call subProc1

next

'------------


Here subProc1 is the main procedure which calls other Procedures to execute a particular task.
The problem is after certain loop like i=45 , the application hangs up and stops responding. I have declared all the variables as global since local vars get stored on stack.
The nos of Procedures called in subProc1 is max 5 or 6. Not more than that.
 
Upvote 0
Yes I agree but I am calling 4 or 5 procedures from the main procedure. I think that's fine, rit?

Btw wats happening is when i becomes =48 , the excel just hangs up, I can select the sheets but can't activate the cells and if i do Ctrl+Break the application closes.

I am pissed off by this error.

BTW 1 qn...


'----------
sub Macro1()

For i=1 to 76

Range("H1")=i

call subProc1

next



end sub
'------------

In the this scenario when I call subProc1 it will stored on the stack rit? Once its executed and control comes to Next it will automatically be removed from stack rit? then how come stack is getting filled?
 
Last edited:
Upvote 0
Have you tried pausing the macro a couple of iterations in - and looking at the stack?

(ie. ctrl L from VBA)
 
Upvote 0
Thanks .. I did it just now. Once cntrol reaches "next" the stack is cleared. it has only Macro1.
But donno wat happens when i=48?
 
Upvote 0
maybe its more to do with your global variables?

Kind of reaching here... maybe try a couple of iterations before 48 and walk through. Add watch to a couple of your globals particularly just in case they are getting too big.
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,645
Members
449,461
Latest member
kokoanutt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top