VBA calculate sheet when opened

Russk68

Well-known Member
Joined
May 1, 2006
Messages
589
Office Version
  1. 365
Platform
  1. MacOS
Hello all,

I have a workbook with many sheets and manual calculation is default by other VBA trigger.

I am in need of code that will calculate a sheet when it is opened and also other sheets that are linked to it as well.

Example:
I open sheet 1.
Sheet 1 calculates.
I also want sheets 3,5and 7 to calculate as well when sheet 1 is opened.

Your help is greatly appreciated!

Russ
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
After thinking about this further, I would like to calculate sheets when exiting a sheet.
This what I have tried:

Private Sub Worksheet_Deactivate()
ThisWorkbook.Sheets("Distro").Calculate
ThisWorkbook.Sheets("Multi Breakdown").Calculate
ThisWorkbook.Sheets("Assign Looms").Calculate
ThisWorkbook.Sheets("Locations").Calculate
ThisWorkbook.Sheets("Patch By Universe").Calculate
End Sub
 
Upvote 0
Code:
[COLOR=#333333]Private Sub Worksheet_Deactivate()[/COLOR]
[COLOR=#333333]Sheets("Distro").Calculate[/COLOR]
[COLOR=#333333]End Sub[/COLOR]

This works for me, are you putting the macro on the sheet or in a module?
 
Upvote 0
On the sheet.

I am getting this error:

Compile error:
Ambiguous name detected: Worksheet_Deactivate

I am also using other VBA on the sheet as well like:

Private Sub Worksheet_Deactivate()
ThisWorkbook.Sheets("Multi Build").Application.Calculation = xlManual
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,971
Messages
6,175,732
Members
452,667
Latest member
vanessavalentino83

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