Runtime Error 28 - Out of stack space

  • Thread starter Bshawn via OfficeKB.com
  • Start date
B

Bshawn via OfficeKB.com

I am using Excel 2003, and have a spreadsheet with a lot of formulas (Most
cells from a1 to IV1700 have formulas in them). I have the spreadsheet set
to calculate manually. I have a command button that triggers a macro, which
the code in the macro is just the one word "Calculate". If I press F9, the
spreadsheet calculates fine, but if I click on the command button, it gives
me the "Out of stack space" error. How can I fix this? Thanks.
 
P

Patrick Molloy

please show us your code. Typically this is caused bt calling a subroutine
and not returning correctly.
When a sub i scalled, the return address is pushed onto the stack, and then
this is removed when the sun returns control back ...if this fails, then the
returns build up indefinitely on the stack...this eats memory...and
eventually you get the failure
 
D

Dave Peterson

Just a guess...

I'm guessing that you have a worksheet_calculate or Workbook_SheetCalculate
event that's firing because of the calculation and it may be calling other
events that call themselves or the _calculate event.

I'd try:

Sub yourmacronamehere()
with application
.enableevents = false
.calculate
.enableevents = true
end with
end sub

But it's just a guess.

The .enableevents tells excel to stop looking for triggers that cause events to
fire.
 
B

Bshawn via OfficeKB.com

That worked! Thanks.

Dave said:
Just a guess...

I'm guessing that you have a worksheet_calculate or Workbook_SheetCalculate
event that's firing because of the calculation and it may be calling other
events that call themselves or the _calculate event.

I'd try:

Sub yourmacronamehere()
with application
.enableevents = false
.calculate
.enableevents = true
end with
end sub

But it's just a guess.

The .enableevents tells excel to stop looking for triggers that cause events to
fire.
I am using Excel 2003, and have a spreadsheet with a lot of formulas (Most
cells from a1 to IV1700 have formulas in them). I have the spreadsheet set
[quoted text clipped - 6 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top