PC Review


Reply
Thread Tools Rate Thread

Auto Calculate Question

 
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      20th Feb 2007
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 With Quote
 
 
 
 
=?Utf-8?B?R2FyeSBCcm93bg==?=
Guest
Posts: n/a
 
      20th Feb 2007
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
(E-Mail Removed)
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 With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      20th Feb 2007
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
> (E-Mail Removed)
> 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 With Quote
 
=?Utf-8?B?R2FyeSBCcm93bg==?=
Guest
Posts: n/a
 
      20th Feb 2007
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
(E-Mail Removed)
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
> > (E-Mail Removed)
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto calculate Barb H Microsoft Excel Worksheet Functions 1 17th Mar 2010 08:01 PM
Auto Calculate Question / HELP! Andy Microsoft Excel Worksheet Functions 2 7th Jan 2010 06:21 PM
Auto Calculate =?Utf-8?B?UmFuZHkgUw==?= Microsoft Excel Misc 1 25th May 2006 01:35 PM
Auto calculate Shane Nation Microsoft Word New Users 3 19th Jun 2004 04:12 PM
auto calculate Neuther Microsoft Excel Misc 3 19th Mar 2004 02:23 AM


Features
 

Advertising
 

Newsgroups
 


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