+ Reply to Thread
Results 1 to 12 of 12

Macro running slowly, copy/paste values only from one workbook to another

  1. #1
    Registered User
    Join Date
    02-03-2011
    Location
    Reno, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro running slowly, copy/paste values only from one workbook to another

    I created a macro that will copy all the worksheets from one workbook and save as values only into another workbook. It works, but it is a little slow. I am doing some looping and wondering if maybe I can consolidate some of the code to make the macro work more efficiently. Thank you in advance for your help.

    Please find the code here:
    Please Login or Register  to view this content.
    Last edited by Jeanette White; 02-03-2011 at 02:35 PM. Reason: Adding code tags

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-03-2011
    Location
    Reno, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro running slowly, copy/paste values only from one workbook to another

    I have added the code tags to my original post, my apologies, this was my first post to this forum.
    Last edited by Jeanette White; 02-03-2011 at 02:37 PM. Reason: Removing duplicated information

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Thanks for taking the time to read and comply with the rule .

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Why do you loop through the worksheets twice?

    You don't need to select, this will slow the code

    Just copy the sheets to a new workbook

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Try this
    Please Login or Register  to view this content.
    Last edited by royUK; 02-03-2011 at 03:45 PM. Reason: add formulas to values

  7. #7
    Registered User
    Join Date
    02-03-2011
    Location
    Reno, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro running slowly, copy/paste values only from one workbook to another

    I get an error in the following block (Red Font) when I run the code. Also, I can't see where the code is opening a new workbook to copy the worksheets too.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-03-2011
    Location
    Reno, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Moderator please mark as solved

    I set application.ScreenUpdating to false at the beginning of my code and it solved the problem.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-22-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Hi I used this Macro and it worked fine in Excel versions prior to 2007 and for some reason there are errors popping up in excel 2007 version. Has anyone encountered the same and if yes do you know what the fix is. Any help here would be much appreciated.

    Error Description - Method 'Undo' of object'_Application' failed
    Procedure: modcopypaste.MakeUndo

    Cheers
    Prad

  10. #10
    Registered User
    Join Date
    06-22-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Hi,

    Following macro is running slowly (30 minutes). I have to copy paste several rows from each drop down box to new worksheet. However, each time calculations have to be made to get data for each drop down list member (there are about 760 members). I am sending the code below. Is there any way to make it work faster with alternative codes.

    Thanks

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Kaplan275,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  12. #12
    Registered User
    Join Date
    06-22-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro running slowly, copy/paste values only from one workbook to another

    Hi Arlette,

    Thanks for your reply, I added new thread.

+ 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