Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Auto Calculate Question

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Auto Calculate Question

Gary,
Thanks for your quick response. I tried something like that earlier
with my code but I am still running into a problem...After I reset the
Applications Calculation status to its original status (which in this case is
Automatic) the code goes right to the Workbook_SheetCalculate subroutine
again resulting in an unending loop. If you can think of anything else that
would help me out I would really appreciate it.

Thanks,
Chad

"Gary Brown" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Auto Calculate Question

How about something like a global Booleen variable like 'blnContinue'. Work
that into your macro with the macro in the Workbook_SheetCalculate procedure
using an IF statement to test for the value of blnContinue prior to running
the macro.

--
HTH,
Gary Brown

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



"Chad" wrote:

Gary,
Thanks for your quick response. I tried something like that earlier
with my code but I am still running into a problem...After I reset the
Applications Calculation status to its original status (which in this case is
Automatic) the code goes right to the Workbook_SheetCalculate subroutine
again resulting in an unending loop. If you can think of anything else that
would help me out I would really appreciate it.

Thanks,
Chad

"Gary Brown" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto calculate Barb H Excel Worksheet Functions 1 March 17th 10 08:01 PM
Auto Calculate Question / HELP! Andy Excel Worksheet Functions 2 January 7th 10 06:21 PM
Auto Calculate Nick Leach Excel Discussion (Misc queries) 1 September 22nd 06 02:42 AM
Auto Calculate Randy S Excel Discussion (Misc queries) 1 May 25th 06 01:35 PM
Auto Calculate - Some... Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 4 January 18th 05 01:37 AM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"