Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error using "Calculate" function in VB
Hi all,
I have been experiencing some problems with the "Calculate" function in an Excel macro, and after consulting the Microsoft MSDN resources for over an hour to no avail, now I turn to you guys for help. I've used the Calculate function in my workbook for weeks now without a problem, but all of a sudden the function stopped working. Now whenever my VB code encounters a Calculate statement, it throws this error: "Runtime error 1004: Cannot run Visual Basic macro because of a syntax error." I have tried using "Application.Calculate" instead of just "Calculate", but that does not stop the error. Also, I have tried turning off and on automatic calculation, but that does not help, either. Interestingly, I have found that the Worksheets.Calculate function _does_ work. So right now I am using a workaround that calculates each sheet individually, but this solution is too slow to use permanently. Any thoughts on what might be causing this strange error?? Thanks for your help - I really appreciate it. Cheers, Deltree P.S. I won't bother quoting my VB code, because it's pretty sophisticated (over 50 subroutines) and _none_ of the Calculate statements work. --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error using "Calculate" function in VB
Hi Deltree,
Have you compiled your code ( VBE--debug--compile vba project), and if so does it highlight a syntax error? Is this VB6 code or VBA code? are the calculate statements in a general module or a class module? Charles ______________________ Decision Models FastExcel Version 2 now available. www.DecisionModels.com/FxlV2WhatsNew.htm "deltree " wrote in message ... Hi all, I have been experiencing some problems with the "Calculate" function in an Excel macro, and after consulting the Microsoft MSDN resources for over an hour to no avail, now I turn to you guys for help. I've used the Calculate function in my workbook for weeks now without a problem, but all of a sudden the function stopped working. Now whenever my VB code encounters a Calculate statement, it throws this error: "Runtime error 1004: Cannot run Visual Basic macro because of a syntax error." I have tried using "Application.Calculate" instead of just "Calculate", but that does not stop the error. Also, I have tried turning off and on automatic calculation, but that does not help, either. Interestingly, I have found that the Worksheets.Calculate function _does_ work. So right now I am using a workaround that calculates each sheet individually, but this solution is too slow to use permanently. Any thoughts on what might be causing this strange error?? Thanks for your help - I really appreciate it. Cheers, Deltree P.S. I won't bother quoting my VB code, because it's pretty sophisticated (over 50 subroutines) and _none_ of the Calculate statements work. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error using "Calculate" function in VB
Charles,
I tried recompiling my VBA probject, and the Calculate function work just fine. Thanks!! BTW, I was using VB6 code, and the calculate statements were in general module, not a class module. Deltre -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text "comparison" operator for "contains" used in an "IF" Function | Excel Worksheet Functions | |||
Turn off "CALCULATE" on bottom of Excel worksheet. near "Ready" | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Functions for "current" & "previous" month to calculate data | Excel Worksheet Functions | |||
Shortcut key for "Paste Options" and "Error Checking" buttons? | Excel Discussion (Misc queries) |