ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime Error 28 - Out of stack space (https://www.excelbanter.com/excel-programming/433191-runtime-error-28-out-stack-space.html)

Bshawn via OfficeKB.com

Runtime Error 28 - Out of stack space
 
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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200909/1


Patrick Molloy[_2_]

Runtime Error 28 - Out of stack space
 
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

"Bshawn via OfficeKB.com" wrote:

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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200909/1



Dave Peterson

Runtime Error 28 - Out of stack space
 
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.


"Bshawn via OfficeKB.com" wrote:

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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200909/1


--

Dave Peterson

Bshawn via OfficeKB.com

Runtime Error 28 - Out of stack space
 
That worked! Thanks.

Dave Peterson wrote:
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]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200909/1



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200909/1



All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com