+ Reply to Thread
Results 1 to 8 of 8

Copy taking an inordinate time to complete

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Copy taking an inordinate time to complete

    Greetings all,

    I am running the following macro to insert a new line with formulas under the header row. The sheet has about 4500 rows of data and 63 columns and is taking 15 seconds to run which seems to me to be a very long time. I added the screen updating, and calculation to see if I could speed it up by turning everything off until it had done what it was supposed to do but that didn't help.

    sub addrow()
    
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
        
        Cells(6, 1).Resize(1, 63).Copy
        Cells(7, 1).Insert shift:=xlDown
        Cells(6, 1).Resize(1, 63).SpecialCells(xlCellTypeConstants).ClearContents
        
        Application.ScreenUpdating = True
        Application.Calculation = xlCalculationAutomatic
    
    end sub
    I would appreciate any suggestions as to how to speed this up.
    Last edited by jacob@thepenpoint; 01-22-2014 at 02:57 PM.
    Jacob Albers
    Excel 2003 & 2010

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy taking an inordinate time to complete

    Hello jacob@thepenpoint,

    Are you saying it takes 15 seconds to do all 4500 rows or 15 seconds to run the macro you posted? I suspect you mean the former.

    The code you have post only inserts a single row. It would be helpful to see the other code that calls this macro.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Copy taking an inordinate time to complete

    Hi Leith,

    Unfortunately, I actually mean the latter. It is taking 15 seconds to insert the single row. This is the entire macro, it will be assigned to a button for the user to add a line when adding production records.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy taking an inordinate time to complete

    Hello jacob@thepenpoint,

    In that case, can you post a copy of the workbook. I can try it out on my system and see if the results are the same.

  5. #5
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Copy taking an inordinate time to complete

    Lieth, do you need the entire file or just a sample portion to extrapolate from? And there are 4 fields that are look ups from an external data file that I will just replace with test data.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy taking an inordinate time to complete

    Hello jacob@thepenpoint,

    If you get the same results with the sample then that will be fine. If not, there is probably a problem with the retrieval of the external data. Something like a slow server, or heavy traffic on the network.

  7. #7
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Copy taking an inordinate time to complete

    Lieth, That looks like the problem. It went to almost instantaneous when I got rid of the Look-ups. Thanks

  8. #8
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Copy taking an inordinate time to complete

    Thanks Lieth, I'll trim it down and check that first.

+ 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. Macro Taking Forever to Complete
    By hk4kim in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 07-22-2013, 01:40 PM
  2. [SOLVED] Split Time Duration to first complete the running hour and then go to End time
    By joogibabu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2013, 10:56 PM
  3. Adding up Absent time taking lunch time into consideration
    By abrilabs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2013, 02:02 PM
  4. [SOLVED] Help taking a time from one field and outputting a time period in a different column
    By Hidden_Gecko in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-07-2013, 12:42 AM
  5. Calculating END time based on start time, breaks, and hours to complete
    By sweedey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2012, 11:29 AM

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