ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can a test to determine whether a workbook needs to be calculated beperformed? (https://www.excelbanter.com/excel-programming/423003-can-test-determine-whether-workbook-needs-calculated-beperformed.html)

Breck

Can a test to determine whether a workbook needs to be calculated beperformed?
 
I have a workbook that has manual calculation turned on. I need to run
a macro that only runs if the workbook needs to be calculated on the
active sheet.

I have found this code Application.CalculationVersion <
activeworkbook.CalculationVersion that appears to perform this test
but it always returns a false value whether the calculation indicator
show calculate or not.


Howard31

Can a test to determine whether a workbook needs to be calculated
 
Hi Breck,


I am not quite sure what you mean by "needs to be calculated", if you mean
that you have changed something on the sheet (because this is normaly the
time a sheet recalculates when in Automatic mode) then put whatever macro you
need to run in the Change event of the sheet *, or if you want the macro to
run on any sheet in the workbook then put the macro in Workbook code module
in the Sheet_Change event.**

Hope this helps.

* Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Something has changed"
End Sub

**Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
MsgBox "Something has changed"
End Sub


--
A. Ch. Eirinberg


"Breck" wrote:

I have a workbook that has manual calculation turned on. I need to run
a macro that only runs if the workbook needs to be calculated on the
active sheet.

I have found this code Application.CalculationVersion <
activeworkbook.CalculationVersion that appears to perform this test
but it always returns a false value whether the calculation indicator
show calculate or not.



Charles Williams

Can a test to determine whether a workbook needs to be calculated be performed?
 
Try Application.CalculationState

Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Breck" wrote in message
...
I have a workbook that has manual calculation turned on. I need to run
a macro that only runs if the workbook needs to be calculated on the
active sheet.

I have found this code Application.CalculationVersion <
activeworkbook.CalculationVersion that appears to perform this test
but it always returns a false value whether the calculation indicator
show calculate or not.





Breck

Can a test to determine whether a workbook needs to be calculated be performed?
 
Thanks works like a charm

"Charles Williams" wrote in message
...
Try Application.CalculationState

Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Breck" wrote in message
...
I have a workbook that has manual calculation turned on. I need to run
a macro that only runs if the workbook needs to be calculated on the
active sheet.

I have found this code Application.CalculationVersion <
activeworkbook.CalculationVersion that appears to perform this test
but it always returns a false value whether the calculation indicator
show calculate or not.






All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com