Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default "Out of Stack Space" Macro Error

I'm trying to create a button which, when clicked on, will calculate the
formulas in the workbook. I have set the workbook to calculate manually. I
recorded the macro as follows:

Sub Calculate()
Calculate
End Sub

However, when I run the macro it gives the error message: Run-time error
'28' Out of stack space". Does anyone know what I am doing wrong? Is there
a better way to allow a user to click on a button to recalculate the cells as
opposed to hitting F9?

Thanks,

Adam
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default "Out of Stack Space" Macro Error

Adam,

You're calling Calculate inside of Calculate. It's a dog chasing its tail. Every call to
Calculate causes another stuff, each time putting more stuff on the stack until it's pushed
to the center of the earth. Then you get that error.

--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Adam" wrote in message
...
I'm trying to create a button which, when clicked on, will calculate the
formulas in the workbook. I have set the workbook to calculate manually. I
recorded the macro as follows:

Sub Calculate()
Calculate
End Sub

However, when I run the macro it gives the error message: Run-time error
'28' Out of stack space". Does anyone know what I am doing wrong? Is there
a better way to allow a user to click on a button to recalculate the cells as
opposed to hitting F9?

Thanks,

Adam



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default "Out of Stack Space" Macro Error

Adam,

I hit send before I was done.

Sub Calculate
Application.Calculate
End Sub

Or do this:

Sub CalculatePlease()
Calculate
End sub

The latter is preferable -- it's not a good idea to use Excel's names for your sub names.

Best form of all:

Sub CalculatePlease()
Application.Calculate
End Sub
--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Earl Kiosterud" wrote in message
...
Adam,

You're calling Calculate inside of Calculate. It's a dog chasing its tail. Every call to
Calculate causes another stuff, each time putting more stuff on the stack until it's
pushed to the center of the earth. Then you get that error.

--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Adam" wrote in message
...
I'm trying to create a button which, when clicked on, will calculate the
formulas in the workbook. I have set the workbook to calculate manually. I
recorded the macro as follows:

Sub Calculate()
Calculate
End Sub

However, when I run the macro it gives the error message: Run-time error
'28' Out of stack space". Does anyone know what I am doing wrong? Is there
a better way to allow a user to click on a button to recalculate the cells as
opposed to hitting F9?

Thanks,

Adam





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default "Out of Stack Space" Macro Error

Because your routine is calling itself recursively.
Try:

Sub Calculate()
Application.Calculate
End Sub

or:

Sub MyCalculate()
Calculate
End Sub

instead.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using "Countif" in macro gives compile error ashish128 Excel Discussion (Misc queries) 4 June 15th 07 12:23 PM
how do I type "itis" without Excel putting a space "it is"? Max Excel Worksheet Functions 4 March 18th 07 10:22 PM
Macro Error "Unable to record" Gary Excel Worksheet Functions 0 December 5th 06 05:24 PM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM


All times are GMT +1. The time now is 09:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"