+ Reply to Thread
Results 1 to 5 of 5

How to stop sheet calculation during a macro.

  1. #1
    Forum Contributor
    Join Date
    07-08-2009
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    183

    How to stop sheet calculation during a macro.

    It is actually just a bit more complicated than the title says.

    Example: I have Sheet 2 set to autocalculate on activate using vb. So when you click on that tab "Sheet 2" it will autocalculate.

    My Question is, I have another macro that is copying information between Sheet 1 and Sheet 2. And I don't want calculation to occur during the macro but since it has to select Sheet 2 it performs the autocalculate.

    Do I have any options to prevent the calculation from occuring when I run my copy paste macro?

    I only want it to autocalculate when the user selects sheet 2

    Thanks for the help!
    Last edited by mrgillus; 08-20-2009 at 11:29 AM.

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: How to stop sheet calculation during a macro.

    Before you do your copy and paste do:
    Please Login or Register  to view this content.
    When you are done set it back:
    Please Login or Register  to view this content.
    Whilst it is false it will stop all event handlers from operating, (Change, SelectionChange, Activate etc etc)
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to stop sheet calculation during a macro.

    Also, this may help:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    07-08-2009
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    183

    Re: How to stop sheet calculation during a macro.

    I will try the events line- as for disabling and enabling during the macro that didn't work since the code to calculate was in the Activate Sheet command so everytime the macro would activate that sheet it would inadvertantly calculate.. This is turning into a frusterating day I must say.. I'm getting ready to post another problem lol.. I really doubt their is a fix to it though.. Thinking I will probably have to change the method to my madness altogether.. but enough on that.. another post to come

  5. #5
    Forum Contributor
    Join Date
    07-08-2009
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    183

    Re: How to stop sheet calculation during a macro.

    Phil, the enable events code works perfectly! And thanks for your input as well JB..

    I greatly appreciate all your guys' help on here!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1