View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown Gary Brown is offline
external usenet poster
 
Posts: 178
Default Auto Calculate Question

Try this....

Dim strOrigCalcStatus As String

'save current calculation setting
Select Case Application.Calculation
Case xlCalculationAutomatic
strOrigCalcStatus = "Automatic"
Case xlCalculationManual
strOrigCalcStatus = "Manual"
Case xlCalculationSemiautomatic
strOrigCalcStatus = "SemiAutomatic"
Case Else
strOrigCalcStatus = "Automatic"
End Select

'set workbook to manual
Application.Calculation = xlCalculationManual

'PUT YOUR CODE HERE

're-set workbook to original calculation status
Select Case strOrigCalcStatus
Case "Automatic"
Application.Calculation = xlCalculationAutomatic
Case "Manual"
Application.Calculation = xlCalculationManual
Case "SemiAutomatic"
Application.Calculation = xlCalculationSemiautomatic
Case Else
Application.Calculation = xlCalculationAutomatic
End Select

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"Chad" wrote:

I have a Macro that runs on Caclulate that looks at a dynamic dataset as well
as a static dataset. If there is a variance between the two datasets, it
will copy the values of the dynamic dataset and paste them into the static
dataset so that there is no more variance.

My problem is that when the workbook I am in is on Auto Calculate it will
exit the subroutine that houses my macro once the data is pasted and go back
to the Workbook_SheetCalculate subroutine and get stuck in a loop because the
variance between the dynamic dataset and the static dataset is never
reconciled. Is there a way I can temprarily bypass the autocalculate
functionality to keep this from happening?

Thanks,
Chad