Toggle Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 
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
 
I bet you meant to use OffSC in one of those lines in the ActivateSortCut (or
ActivateShortcut???) module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top