Using a Macro to set Calculation Mode to Manual

mangoel

New Member
Joined
Apr 14, 2002
Messages
14
Hello All,

I was wondering if it is possible to automatically set the calculation mode in Excel to "Manual" through an workbook_open event or through the press of a command button. The interactions in a workbook that I have created require the calculation mode to be set to manual.

I would really apreciate your help with this. Thanks!

Manish
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
On 2002-05-03 15:34, mangoel wrote:
Hello All,

I was wondering if it is possible to automatically set the calculation mode in Excel to "Manual" through an workbook_open event or through the press of a command button. The interactions in a workbook that I have created require the calculation mode to be set to manual.

I would really apreciate your help with this. Thanks!

Manish

In the This Workbook Object Code paste the following.


Private Sub Workbook_Open()

With Application
.Calculation = xlManual
.MaxChange = 0.001
End With

End Sub

Below is some nice code you can add to avoid having to go through the menus all the time.

I have added this to my personal macro book and use ALL the time.

It toggles Calculation on/off and is assigned to a permanent button on my toolbar.

Sub Toggle_Calc()

If Application.Calculation = xlCalculationAutomatic Then

With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
Else
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
End If

End Sub<MARQUEE/> :cool: Hope This Helps :cool:</MARQUEE>


_________________<A HREF= "http://website.lineone.net/~s-o-s/Index.html">
image001.gif

This message was edited by s-o-s on 2002-05-03 15:40
This message was edited by s-o-s on 2002-05-03 15:41
 
Upvote 0
Here's another thought. Get the setting of the end-user when they open the workbook. Then set Excel to manual and when they close the workbook, return Excel the user's original setting. I used auto_macros, these go in a normal module:

Code:
Private clcmd As Long

Sub auto_open()
clcmd = Application.Calculation
Application.Calculation = xlManual
End Sub

Sub auto_close()
Application.Calculation = clcmd
End Sub

Make sure your private command is at the top of the module. Hope this helps.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
wave.gif

This message was edited by NateO on 2002-05-03 16:01
 
Upvote 0
Thank you very much for you replies.
I have tried both suggestions and both work for me! :)

I was just curious, if I choose to use the "Workbook_Open" event to change the calc mode to Manual (in the ThisWorkbook Module), what would the corresponding close workbook event be that I can use to restore the original mode? Is is Workbook_Close?? or something else? Thanks again for all your help!!

Manish
 
Upvote 0
Use the same code (the whole schpeil, variables, vba, etc....) in the "thisworkbook" module, just make substitutions, workbook_open, woorkbook_close.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
wave.gif

This message was edited by NateO on 2002-05-04 09:05
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,185
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top