Calculate sheet macro

Russk68

Well-known Member
Joined
May 1, 2006
Messages
589
Office Version
  1. 365
Platform
  1. MacOS
Hi All,
I need a macro that will set calculations to manual when a sheet is opened and calculate the sheet with the Enter key.

Your help is greatly appreciated!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Re: Need help with calculate sheet macro

Enter this in "ThisWorkbook" object:

Code:
Private Sub Workbook_Open()

Application.Calculation = xlManual


Application.OnKey "~", "myMacro1"


End Sub

And in a module:


Code:
Sub myMacro1()

Application.Calculation = xlAutomatic


End Sub
 
Upvote 0
Re: Need help with calculate sheet macro

Hi
I haven't had a chance to try this yet but thank you very much for the code!

Russ
 
Upvote 0
Hi
I just wanted to know if I was doing this right.
To enter in ThisWorkbook, right click on ThisWorkbook, View Code and paste code?

Add in a Module, right click ThisWorkbook, Insert> Module and paste code?
 
Upvote 0
Cool!
I may not have explained myself well.
I want the workbook to always be in Manual mode.
In any worksheet when I hit enter, I want just that worksheet to calculate each time.
I think your code is calculating the workbook with the Enter key. Is that correct?
 
Upvote 0
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">That is correct.

Try replacing Application.Calculation = xlAutomatic with ActiveSheet
.Calculate</code>
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

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