+ Reply to Thread
Results 1 to 7 of 7

Paste Special drastically slowing down macro?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Paste Special drastically slowing down macro?

    Ok so I am in the process of creating a pretty large macro. When I ran the macro before, it would generally run through everything fairly quickly. Then, I added the following code and it has drastically slowed down the macro making it take awhile to finish the script. Anything I should do to cut down the running time or is it just taking a long time based on the nature of the function?

    Please Login or Register  to view this content.
    What the function does is dynamically copy from M15 to the last available row in column M and simply copies and then pastes the formulas as values.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Paste Special drastically slowing down macro?

    alternatively,
    Please Login or Register  to view this content.
    and you will have less in the clip.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,034

    Re: Paste Special drastically slowing down macro?

    You could try dropping all the Selects and Selections:

    Please Login or Register  to view this content.
    Switch off calculation, screen updating and event handling before and back on again afterwards, if you're not doing that already.

    To enable testing and, perhaps a more specific solution, you could upload a de-sensitized sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Paste Special drastically slowing down macro?

    Quote Originally Posted by berlan View Post
    alternatively,
    Please Login or Register  to view this content.
    and you will have less in the clip.
    I tried this and it definitely reduces the processing of the macro but it still takes awhile. My macro is pretty extensive creating over 30 workbooks. Before I added this copy and paste as values, the entire macro would take maybe just over a minute to complete.

    Then I added 3 dynamic copy and paste as values in 3 different columns. These columns can range from having 1,000 to over 5,000 rows of data. This is across 30+ workbooks. Adding these functions increased the processing time of my macro an additional 3 minutes even after using berlan's suggestion.

    I'm positive this copy and paste as values is the only thing causing the issue, because if I take this part of the code out, the macro finishes in about a minute. So is it just the nature of the function: copying and pasting 1,000 - 5,000 rows three different times across 30+ workbooks that increases the macro processing time over 3 additional minutes?

    Oh and in regards to your suggestions TMS, screen updating is turned off for the entire macro.
    Last edited by nobodyukno; 07-17-2015 at 10:24 AM.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,034

    Re: Paste Special drastically slowing down macro?

    Set calculation to Manual before and to Automatic afterwards.

    How do you determine Lastrow?

  6. #6
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Paste Special drastically slowing down macro?

    Quote Originally Posted by TMS View Post
    Set calculation to Manual before and to Automatic afterwards.

    How do you determine Lastrow?
    Is there a way to do that with VBA?

    Here is how I determine lastRow:

    Please Login or Register  to view this content.
    I do the same thing for two different columns

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,034

    Re: Paste Special drastically slowing down macro?

    Please Login or Register  to view this content.

+ 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. Auto run macro from paste or paste special in to specific cell
    By Craig Muir in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2014, 10:00 AM
  2. [SOLVED] Simple copy and paste macro- Paste special help needed.
    By hernancrespo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 07:02 AM
  3. Word slowing down using >paste special< with no links
    By Roberthorse in forum Excel General
    Replies: 0
    Last Post: 10-22-2012, 01:36 PM
  4. Macro Paste Special
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2009, 03:25 AM
  5. paste special macro
    By stevesunfold in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-05-2009, 04:41 PM
  6. Macro for paste-special
    By 50pingviner in forum Excel General
    Replies: 2
    Last Post: 02-09-2007, 10:58 AM
  7. Macro Special Paste - Value
    By Souriane in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-02-2005, 10:40 AM

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