+ Reply to Thread
Results 1 to 25 of 25

Macro slow on update

  1. #1
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Macro slow on update

    Someone helped me out with this macro to copy information from one sheet to another.
    However I have been able to move things around and now have every thing on one page
    but the macro had slowed right down. I thought perhaps because it was referring to
    to itself so I changed this line; With Sheets("this worksheet") I also tried Active Worksheet.
    Can anyone tell me what it should be? Thanks in advance.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    It needs to be the name of the sheet your data is on.
    How many rows of data do you have?

  3. #3
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    Probably 250 rows at most. Was it you who game me the above? I couldn't remember.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    If it's only 250 rows, then it should be virtually instant (under a second).
    Do you have any event code running on that sheet?

  5. #5
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    There's a userform splashscreen but it is gone before the macro is run. Nothing else though.

    I've timed it at 16 seconds with 55 rows.
    Last edited by And180y; 06-12-2020 at 06:08 PM.

  6. #6
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    What I have found is that if the name in column J had no entry in column G that week then it is slow. Once I removed the names with no entry it is instant.
    However the name could be there the next week, if that makes sense?

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Whether a name is there or not should make no difference.
    Please supply a sample workbook showing the problem.

  8. #8
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    Hi Fluff13, thanks for getting back to me. sheet attached.
    Would it be quicker if the reference to column J was removed so that it
    returned each unique name in G to J once with the numbers in K? That way there would never be any blanks?
    Last edited by And180y; 06-14-2020 at 06:21 AM.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Thanks for that, but it only takes ~.03 seconds to run for me.
    If you want to get rid of the names in J, try
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Macro slow on update


    Hi,

    according to this poor attachment the result is instant !
    Could be a little bit quicker if results are updated at once rather than looping cell by cell …

    Is the issue at the first run ?
    Any chance you attach the workbook which you have the issue ? …

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Macro slow on update


    I forgot to mention : with such few data it can be easily achieved without any dictionary - but as fast - and just with a single loop …

  12. #12
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Macro slow on update

    a little faster
    Please Login or Register  to view this content.

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Another option if you have dynamic arrays
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    All the ideas work guys, thanks so much.

    Is there an easy way to make them run in earlier versions?

  15. #15
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    You're welcome & thanks for the feedback.

    The code from post#13 won't work unless you have dynamic arrays, but the other codes should work in any version.

  16. #16
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    They are giving a run-time error 13 "mismatch" but I cant see how.

  17. #17
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Which code & which line?

  18. #18
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    The one you gave me in post 9 is returning two rows of 0s and no names. This one runs but only gives the 0s
    The one in post 12 fails at this line. .Value = Application.Transpose(Array(d.Keys, d.Items)) This is the mismatch one

  19. #19
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Is that on your sample file, or your real workbook?

  20. #20
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    Hi Fluff13, sorry on the real workbook. Not sure why as the sample is identical.

  21. #21
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Do the codes work on the sample file?

  22. #22
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    Hi Fluff13, yes perfect on the sample and just the two rows of 0s in the actual workbook.
    I think its just going to have to suffer the slow speed?

  23. #23
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    In that case there is obviously something different with your real data.

  24. #24
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro slow on update

    Fluff13, thanks again. Can you think of anything that would allow it to run fine in 365 version 2007 but not in earlier versions?

  25. #25
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Macro slow on update

    Fraid not.

+ 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. Slow macro, slow pc or wrong code?
    By corky81 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2018, 05:58 AM
  2. [SOLVED] Screen update - does not work? Merged cells and border lines are slow to update?
    By flabb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2016, 03:30 AM
  3. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  4. [SOLVED] slow computer (slow clipboard) breaks my macro
    By twilsonco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 09:16 PM
  5. Slow update (how to improve)
    By Stingone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-15-2012, 01:47 PM
  6. Slow Update Workbook
    By tuckjoseph in forum Excel General
    Replies: 9
    Last Post: 02-05-2010, 03:29 PM
  7. CheckBox update slow
    By wiggles in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-23-2008, 08:22 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