Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using "Countif" in macro gives compile error | Excel Discussion (Misc queries) | |||
how do I type "itis" without Excel putting a space "it is"? | Excel Worksheet Functions | |||
Macro Error "Unable to record" | Excel Worksheet Functions | |||
Shortcut key for "Paste Options" and "Error Checking" buttons? | Excel Discussion (Misc queries) | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) |