+ Reply to Thread
Results 1 to 6 of 6

Macro takes 20 seconds to run, can anyone please help to make it more efficient?

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    Please Login or Register  to view this content.
    Last edited by FDibbins; 10-31-2013 at 06:44 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    It probably slow because you are triggering it everytime you paste, so it is running multiple times. Try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    Hi, I am just starting to get into VB Macro's and need some help.

    The background is that I have a sheet that is semi-protected, there is a section that I have applied conditional formatting to that users can type into (required for the function of the sheet).
    Users traditionally like to copy and paste from within this range, when they do the conditional formatting is being copied also. I have no hope of teaching users about paste special.

    The macro simply refers to an identical hidden sheet with correct formatting and when users change the selection in the relevant section of the sheet it replaces the formatting with unspoilt formatting and returns the user to the origional cell (very important for effective data entry).

    It seems to do everything that i need it to do but takes ages 18>20+ seconds...
    I would like to try and get it down to less than a second if possible.

    Please see the code below.

    Regards
    Adrian


    Please Login or Register  to view this content.
    Last edited by FDibbins; 10-31-2013 at 06:44 PM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    Adrian welcome to the forum

    2 things to note please...

    1. Please use code tags around your VBA code. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here (I will add them for you - this time)

    Also, please do not post duplicate threads. I will merge your other 1 with this, you can continue here

    Thanks
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    10-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    Thanks FDibbins,

    Sorry, first time posting - I will apply correct process next time.
    I actually did not realise that I posted more than once.

    Regards
    Adrian

  6. #6
    Registered User
    Join Date
    10-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro takes 20 seconds to run, can anyone please help to make it more efficient?

    Thanks stnkynts,

    This certainly is a lot faster, it has shaved about 15 seconds from the total processing time.
    It still takes about 4-5 seconds to run, ideally it would be done in less than 1.

    When I copied the format over without remembering the active cell, it was achieving <1 second speeds.
    Maybe I need to try and look outside the square a little more? None the less, you have made the sheet usable...

    Regards
    Adrian

+ 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 takes approx. 15 seconds to run, how do i reduce run time?
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-25-2012, 07:15 AM
  2. Replies: 2
    Last Post: 10-17-2012, 06:26 AM
  3. My current macro takes 20 minutes + to run. How can this code be made more efficient??!!
    By Mr.Whiskers in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-11-2012, 11:02 AM
  4. Replies: 9
    Last Post: 07-13-2006, 03:19 PM
  5. Replies: 1
    Last Post: 07-13-2006, 12:55 PM

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