Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Turn off "CALCULATE" on bottom of Excel worksheet. near "Ready" chrispal86 Excel Discussion (Misc queries) 2 February 2nd 10 08:36 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Functions for "current" & "previous" month to calculate data Priss Excel Worksheet Functions 11 April 15th 08 06:24 PM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM


All times are GMT +1. The time now is 08:35 AM.

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"