Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Calculate on Status Bar causing VBA to run very slow


I have a workbook which has exceeded Excels limit of 65,536 dependencies.
Consequently I have the 'Calculate' message on the status bar. This does not
pose any problems. However, if the user executes some VBA code, the length
of time time taken to execute can be several minutes for code that can
normally executes in seconds.

Is there a way to force a recalc (F9 or alt+ctrl+F9) and then instruct VBA
to execute procedures without being slowed down by Excel?

Or have I interpreted incorrectly what Excel/VBA is doing?

Any help will be greatly appreciated.

Kind regards,

Darren.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Calculate on Status Bar causing VBA to run very slow

Hi Darren,

You could do something like this to see if it helps:

Sub demo()
Dim lCalcMode As Long

With Application
lCalcMode = .Calculation
.Calculation = xlCalculationManual
.Calculate
End With

'/ do your stuff here

With Application
.Calculate
.Calculation = lCalcMode
End With
End Sub


Lots more details on calculation available he

http://www.decisionmodels.com/calcsecretsh.htm


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Darren Elsom wrote:
I have a workbook which has exceeded Excels limit of 65,536
dependencies. Consequently I have the 'Calculate' message on the
status bar. This does not pose any problems. However, if the user
executes some VBA code, the length of time time taken to execute can
be several minutes for code that can normally executes in seconds.

Is there a way to force a recalc (F9 or alt+ctrl+F9) and then
instruct VBA to execute procedures without being slowed down by Excel?

Or have I interpreted incorrectly what Excel/VBA is doing?

Any help will be greatly appreciated.

Kind regards,

Darren.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Calculate on Status Bar causing VBA to run very slow

Thanks for the help. The codes now executes in the normal length of time as
it did before I put in too many dependencies!!

One question.

When the application is told to calculate within VBA. Will it calculate all
open workbooks, or just the active one? As my code creates a new workbook
and tranfers info from the source to the new workbook.

Regards,

Darren.


"Jake Marx" wrote in message
...
Hi Darren,

You could do something like this to see if it helps:

Sub demo()
Dim lCalcMode As Long
With Application
lCalcMode = .Calculation
.Calculation = xlCalculationManual
.Calculate
End With
'/ do your stuff here
With Application
.Calculate
.Calculation = lCalcMode
End With
End Sub


Lots more details on calculation available he

http://www.decisionmodels.com/calcsecretsh.htm


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Darren Elsom wrote:
I have a workbook which has exceeded Excels limit of 65,536
dependencies. Consequently I have the 'Calculate' message on the
status bar. This does not pose any problems. However, if the user
executes some VBA code, the length of time time taken to execute can
be several minutes for code that can normally executes in seconds.

Is there a way to force a recalc (F9 or alt+ctrl+F9) and then
instruct VBA to execute procedures without being slowed down by Excel?

Or have I interpreted incorrectly what Excel/VBA is doing?

Any help will be greatly appreciated.

Kind regards,

Darren.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Calculate on Status Bar causing VBA to run very slow

Hi Darren,

Darren Elsom wrote:
Thanks for the help. The codes now executes in the normal length of
time as it did before I put in too many dependencies!!


Great.

One question.

When the application is told to calculate within VBA. Will it
calculate all open workbooks, or just the active one? As my code
creates a new workbook and tranfers info from the source to the new
workbook.


If you use Application.Calculate, it should calculate all open workbooks.
You can also specify the workbook or worksheet to calculate. But IIRC,
there are some oddities to these methods - the link I gave you to Charles'
site goes into some of those I think.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

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
Why does 'calculate' show in the status bar, even after i hit F9? Sam Excel Discussion (Misc queries) 1 October 20th 08 04:43 PM
Macros Causing Workbook to Run Very Slow [email protected] Excel Discussion (Misc queries) 6 August 20th 07 05:14 PM
calculate message in status bar neda5 Excel Discussion (Misc queries) 3 April 11th 06 06:07 PM
'Calculate' message at the status bar Charles Williams Excel Programming 0 September 12th 03 07:37 PM
What's causing file to increase in size and slow program? jfeka[_2_] Excel Programming 5 August 1st 03 01:38 PM


All times are GMT +1. The time now is 09:43 AM.

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

About Us

"It's about Microsoft Excel"