+ Reply to Thread
Results 1 to 6 of 6

Prevent Worksheet Recalculation with Macro that Pastes

  1. #1
    Registered User
    Join Date
    01-11-2014
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    21

    Prevent Worksheet Recalculation with Macro that Pastes

    I currently have a Macro which searches a range for blank cells, selects all non-Blank cells within that range and Copies them. I have another Macro which Pastes them. Several of the cells that I copy include =Randbetween(0,99), and as soon as my Paste macro performs its Paste operation, all of my Randbetweens re-roll. The Randbetweens come from a different sheet, so I'd like to prevent all cells/processes from updating on the entire document, not just one sheet.

    How can I prevent this macro from triggering an update/recalculation?


    Please Login or Register  to view this content.
    And for reference, the PasteValues is
    Please Login or Register  to view this content.

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Prevent Worksheet Recalculation with Macro that Pastes

    Please Login or Register  to view this content.
    Please click the * below if this helps

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,259

    Re: Prevent Worksheet Recalculation with Macro that Pastes

    But don't forget to put it back on after ....your code
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-11-2014
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Prevent Worksheet Recalculation with Macro that Pastes

    I could cry, then I could bake you a cake....

    All it took was adding the xlCalculationManual abefore it.

    Thank you thank you thank you!

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Prevent Worksheet Recalculation with Macro that Pastes

    @bakerman2 :That would actually calculate the sheet, that's why I didn't add it in. It'd rather go for semiautomatic, or leave it manual...

    @Elieson - why do you put the paste in another sub?
    Wouldn't this do the trick:

    Replace
    Please Login or Register  to view this content.
    With
    Please Login or Register  to view this content.
    Last edited by JasperD; 07-26-2015 at 05:08 AM.

  6. #6
    Registered User
    Join Date
    01-11-2014
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Prevent Worksheet Recalculation with Macro that Pastes

    I have a few other macros that use my PasteValues macro, so I condensed it so split it among the four other macros that use it for their respective sheets.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Prevent recalculation when opening .csv file
    By duffry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2014, 09:20 AM
  2. Replies: 1
    Last Post: 10-03-2012, 07:06 PM
  3. Replies: 2
    Last Post: 09-05-2012, 03:20 PM
  4. [SOLVED] Automating a macro that copies and pastes data and pastes 2 rows under the previous one.
    By thebank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2012, 05:02 PM
  5. Prevent recalculation when opening earlier versions
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  6. [SOLVED] Re: Prevent recalculation when opening earlier versions
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  7. [SOLVED] Prevent recalculation when opening earlier versions
    By Mats Nilsson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2005, 12:06 PM

Tags for this Thread

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