Run macro by pressing F12

George J

Well-known Member
Joined
Feb 15, 2002
Messages
959
I have the following code to switch the sheet calculation from Manual (done to speed up another macro - copy & paste lots of detail from other sheets), to Automatic.

I am not sure how to go about it, but am sure the onkey command is correct.

Private Sub Worksheet_calculate()
Application.OnKey "{F12}", "Calculate_Auto"
End Sub

Any tips appreciated.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
On 2002-03-28 04:49, George J wrote:
I have the following code to switch the sheet calculation from Manual (done to speed up another macro - copy & paste lots of detail from other sheets), to Automatic.

I am not sure how to go about it, but am sure the onkey command is correct.

Private Sub Worksheet_calculate()
Application.OnKey "{F12}", "Calculate_Auto"
End Sub

Any tips appreciated.

Hi George
have you tried using the follwoing to switch
it On/Off ?

Application.Calculation = xlCalculationManual
Application.Calculation = xlCalculationAutomatic


Ivan
 
Upvote 0
The Calculate_Auto macro I am trying to run has that covered (I think). I am really wanting a one key press to revert back to Automatic calculation for the whole sheet. I know pressing F9 refreshes the calculations, but the option is still set to manual.

Sub Calculate_Auto()
'
' Calculate_Auto Macro
' Macro recorded 28/03/2002 by gj
'

'
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
End Sub

Any ideas? :cry:
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,162
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