Simple "Caclulate" not working

The_Kurgan

Active Member
Joined
Jan 10, 2006
Messages
270
Due to a large number of calulcations and a lot of data, it has been decided to put the Calculate function in the users' hands. Since many are not savvy enough to know to hit F9 or find it in the ribbon, I created a button whose only command is "Calculate" within the code. Yet, for some reason, it only calculates the active sheet.

Code:
Private Sub CommandButton1_Click()
Calculate
End Sub

It doesn't get much simpler than this, so... what the heck am I missing???

Thanks in advance!
(Excel 2007)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
From Help....

Application.CalculateFull Method
Forces a full calculation of the data in all open workbooks.
Syntax

expression.CalculateFull

expression A variable that represents an Application object.

Example


This example compares the version of Microsoft Excel with the version of Excel that the workbook was last calculated in. If the two version numbers are different, a full calculation of the data in all open workbooks is performed.

Visual Basic for Applications
If Application.CalculationVersion <> _
Workbooks(1).CalculationVersion Then
Application.CalculateFull
End If
 
Upvote 0
Thanks for the post, Jim. I tried the Application.CalculateFull and it doesn't like that at all. The calculation takes an inordinate amount of time to run and still does not calculate the other sheet within the worklbook.

There really is no reason this code shouldn't work. When I hit the "Calculate Now" button on the Formulas menu in the ribbon, it works. However, the code that button runs is "Caclulate" as evidenced by recording a macro.

I just noticed, however, that if I create a public sub and call it by my button, it works. Go figure... seems like a glitch to me.

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,948
Latest member
UsmanAli786

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