ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toggle Macro (https://www.excelbanter.com/excel-programming/392980-toggle-macro.html)

Beep Beep

Toggle Macro
 
I am using a number of workbooks that need to have the manual calculation
turned on so I can see the number of documents in the filter at the bottom of
the screen, however when I go to another worksheet then I have to either
remember to hit F9 or change the tools option command. I have to filter on
numerous releases.

Any way that I can toggle this option on and off by pressing a couple keys??
Such at ctrl t to turn it on and ctrl o to turn it off.

Thanks


Bob Phillips

Toggle Macro
 
Add this to a button


Sub ToggleCalculation()
With Application
If .Calculation = xlCalculationManual Then
.Calculation = xlCalculationAutomatic
Else
.Calculation = xlCalculationManual
End If
End With
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Beep Beep" wrote in message
...
I am using a number of workbooks that need to have the manual calculation
turned on so I can see the number of documents in the filter at the bottom
of
the screen, however when I go to another worksheet then I have to either
remember to hit F9 or change the tools option command. I have to filter
on
numerous releases.

Any way that I can toggle this option on and off by pressing a couple
keys??
Such at ctrl t to turn it on and ctrl o to turn it off.

Thanks




Halim

Toggle Macro
 
Hi,

Just adding some... from Bob's,
that you wish to use some sortcut:
Such at ctrl t to turn it on and ctrl o to turn it off.


'if you wish to use sortcut
Sub ActivateSortcut()
Application.OnKey "^t", "OnSC"
Application.OnKey "^o", "OnSC"
End Sub

Sub OnSC()
Application.Calculation = xlCalculationAutomatic
End Sub

Sub OffSC()
Application.Calculation = xlCalculationManual
End Sub

'after you use the sortcut, then turn it off
Sub DeactivateSortcut()
Application.OnKey "^t"
Application.OnKey "^o"
End Sub

--

Regards,

Halim



Dave Peterson

Toggle Macro
 
I bet you meant to use OffSC in one of those lines in the ActivateSortCut (or
ActivateShortcut???) module.



Halim wrote:

Hi,

Just adding some... from Bob's,
that you wish to use some sortcut:
Such at ctrl t to turn it on and ctrl o to turn it off.


'if you wish to use sortcut
Sub ActivateSortcut()
Application.OnKey "^t", "OnSC"
Application.OnKey "^o", "OnSC"
End Sub

Sub OnSC()
Application.Calculation = xlCalculationAutomatic
End Sub

Sub OffSC()
Application.Calculation = xlCalculationManual
End Sub

'after you use the sortcut, then turn it off
Sub DeactivateSortcut()
Application.OnKey "^t"
Application.OnKey "^o"
End Sub

--

Regards,

Halim


--

Dave Peterson


All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com