Worksheets not calculating

CDelSignore

New Member
Joined
Mar 1, 2016
Messages
18
I'm using Excel 2010 and trying to one-button automate updating a spreadsheet. The button should refresh two tables from outside (networked) workbooks and then calculate worksheets in the open workbook, in a specified order.
Here is my macro the button is linked to:
Sub Workbook_UpdateAll()​
ActiveWorkbook.RefreshAll​
MsgBox "Done Refreshing Data and OEE Sheets"​
ActiveWorkbook.Worksheets("Calculation Sheet").Calculate​
MsgBox "Done Calculating Calc Sheet"​
ActiveWorkbook.Worksheets("Production Numbers").Calculate​
MsgBox "Done Calculating Production Numbers Sheet"​
ActiveWorkbook.Worksheets("Production").Calculate​
MsgBox "Done Calculating Production Sheet"​
End Sub

At this time, the two tables refresh as intended, but none of the worksheets calculate. The calculation sheet updates last lines of data on the Data and OEE tables, and lists out arrays that the Production Number and Production worksheets use as part of Indirect functions. The messageboxes come up, but the worksheets don't calculate. The order of calculation is important.

Any idea what's going wrong?
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Update: I recorded a Macro and got the following:
Sub UpdateAll()
' Refreshes linked tables and calculates sheets in proper order
ActiveWorkbook.RefreshAll
Sheets("Calculation Sheet").Select
ActiveSheet.Calculate
Sheets("Production Numbers").Select
ActiveSheet.Calculate
Sheets("Production").Select
ActiveSheet.Calculate
Sheets("TableOfContents").Select​
End Sub​

When I recorded the Macro, it performed exactly as I wanted it to. I copied the code and closed the file (without saving). When I reopened, I replaced the code (listed in the opening post) with the new code. It refreshed but did not calculate.

Can someone explain what's going wrong? I'd be close to pulling my hair out, but I'm bald and not touching the beard. :LOL::cool:

Update #2 ... if I run the Macro a second time, it calculates as desired.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

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