View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Eric Eric is offline
external usenet poster
 
Posts: 1,670
Default How to enable / disable re-calculation option?

When I run a macro as shown below, how does excel define the application
area?

calcmode = application.calculation
application.calculation = xlCalculationManual
'open worksheet2.xls by using worksheet1's macro
application.calculation = calcmode

Case 1
If I open an excel worksheet1.xls, then I open worksheet2.xls within this
open worksheet1, do I open 1 excel application? If I set calcmode, will it
apply to both worksheets at this moment?

Case 2
If I open an excel worksheet1.xls, then I open another excel application and
open worksheet2.xls, do I open 2 excel application? If I set calcmode for
worksheet2, will it apply to worksheet1.xls at this moment?

Do you have any suggestions?
Thanks in advance for any suggestions
Eric


"Dave Peterson" wrote:

Dim CalcMode as long

calcmode = application.calculation
application.calculation = xlCalculationManual
'your code here
application.calculation = calcmode

This actually saves the current calculation mode, changes (or keeps) it to
manual, then changes it back to what it was when you started.

Eric wrote:

I would like to disable re-calculation option during running my macro.
Does anyone have any suggestions on how to add code to enable / disable
re-calculation option?
Thanks in advance for any suggestions
Eric

For example
Sub mymacro

' I would like to disable re-calculation option here

Macro's coding

' I would like to enable re-calculation option here
End Sub


--

Dave Peterson
.