Msg Box Appears multiple times due to worksheet calculations

apnovice

New Member
Joined
Aug 23, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a workbook that auto refreshes whenever a new date is inputed into a certain cell. This triggers 8 different database queries that returns data to different sheets. Each time a query is complete, that sheet calculates. I have a message box that says "report done" but it keeps popping up multiple times which I assume is because its running every time there is a worksheet calculation. I added a code I found off the internet to try and prevent the msg box from running until all workbook calculations are complete but still have no luck. The below code is in the ThisWorkbook part in vba. Any help would be much appreciated. Thanks!

Private Sub Worksheet_Calculate()
MsgBox "Report Has Completed", vbInformation, "Thermo Fisher Scientific"
Do
Loop Until Application.CalculationState = xlDone
End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,104
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Put this in the worksheet you are inputting the data to.
VBA Code:
Private Sub Worksheet_Calculate()
Calculate
MsgBox "Report Has Completed", vbInformation, "Thermo Fisher Scientific"
End Sub
 

Forum statistics

Threads
1,148,257
Messages
5,745,709
Members
423,968
Latest member
CHHeights

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
Top