Stopping Auto Calculating in VBA

BJS1002

New Member
Joined
Jul 28, 2016
Messages
17
Hi,

Hoping someone can help.

I have the below VBA code within a workbook (book 1) on Sharepoint.
It opens a separate workbook also on Sharepoint, filters data and copies it to a sheet in book 1.
Then I have Index match formulas in another sheet in book 1 that finds the data

It does everything I need to it do, but I'm finding the workbook is recalculating every couple of minutes.
If I remove the below VBA code from book 1 it stops recalculating.

Any Help would be greatly appreciated

--------------------------------------------------------------

Dim wb1 As Workbook, wb2 As Workbook, numrows As Double

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual


Set wb1 = ThisWorkbook

wb1.Sheets("Summary").Activate
Sheets("Summary").UsedRange.ClearContents


IDMlocation = "https://sharepoint.com/Shared Documents/General/Project tracker/TASK_SIGNOFF_REPORT.csv"

Set wb2 = Workbooks.Open(Filename:=IDMlocation, ReadOnly:=False)

With wb2.Sheets("TASK_SIGNOFF_REPORT")

'' Filters for programs ''
Range("G:G").AutoFilter _
Field:=1, _
Criteria1:=Array("XXXX" & "*"), Operator:=xlFilterValues

Columns("C:F").EntireColumn.Hidden = True
Columns("H:K").EntireColumn.Hidden = True
Columns("U:V").EntireColumn.Hidden = True


numrows = ActiveSheet.Range("B:B").End(xlDown).Row
rangestring = "A1:V" & numrows

Range(rangestring).Copy _
Destination:=wb1.Worksheets("Summary").Range("A1")

End With

wb2.Close

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
@ BJS1002, I am a bit confused by your question.

From what I can see, you use code to turn off the auto updating ...
VBA Code:
   Application.ScreenUpdating = False
   Application.DisplayAlerts = False
   Application.EnableEvents = False
   Application.Calculation = xlCalculationManual

And further down, you use code to turn the auto updating back on with the following ...
VBA Code:
   Application.ScreenUpdating = True
   Application.DisplayAlerts = True
   Application.EnableEvents = True
   Application.Calculation = xlCalculationAutomatic

Your question stated that you wanted to stop the auto calculation from occurring, and then you stated that if you removed the code that you posted, it doesn't recalculate. So what exactly are you asking?
 
Upvote 0

Forum statistics

Threads
1,214,405
Messages
6,119,320
Members
448,887
Latest member
AirOliver

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