VBA turn off auto-calculate + button to calculate

DarkSmile

Board Regular
Joined
Feb 22, 2021
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need 2 VBA codes, I have a file with a lot of formula's and don't want them to calculate all at the same time.

First VBA; should turn auto-calculate of at all time
I tried this in ThisWorkBook module but doesn't seem to work?

VBA Code:
Private Sub Workbook_Open()
    Application.Calculation = xlCalculationManual
End Sub


The second one I would like to only calculate the rows that are filtered. So how the file works is; I filter column B , and it gives me the rows.
I want a button that I can click so it calculates the formulas for the filtered rows only.


Hopefully its clear enough.

Thank you,
David
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I think I found an option for the first part.

VBA Code:
Private Sub Workbook_Open()
    Application.Calculation = xlManual
    Application.CalculateBeforeSave = False
End Sub

Second part not yet.
 
Upvote 0
VBA Code:
Sub Calculate()
    Dim answer As Integer

        answer = MsgBox("Wil je de formules refreshen?", vbQuestion + vbYesNo + vbDefaultButton2, "Refresh Formulas")
    If answer = vbYes Then
        Sheets("Planningstabel").Range("A3:I1048576").SpecialCells(xlCellTypeVisible).Calculate
    Else
    End If
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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