+ Reply to Thread
Results 1 to 21 of 21

[SOLVED] Speed up VBA loop - for 60K rows data

  1. #1
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    [SOLVED] Speed up VBA loop - for 60K rows data

    Hi,

    Update: turning the calculation to manual worked for 15k rows data but does not work for 60k rows of data. Any other way to speed up the loop?



    I have the code below run through 15k rows of data. its currently taking very long time (more than 30mins) to run this code. Is there anyway to speed this up? Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by reiiling; 02-07-2019 at 06:49 AM.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Speed up VBA loop

    Can you post a small example file so we have something to work with.

    Remember to desensitize your data.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Speed up VBA loop

    I see you have turned off screen updating, what if you set the calculation mode to manual as well?

    Application.Calculation = xlCalculationManual

    if there are other formulas in the workbook it may speed things up

  4. #4
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop

    the attachment does seems to be working for me. So I have attached image here.
    I have cleared unused columns for this code, and renamed everything.

    sheet1.PNG
    sheet2.PNG

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Speed up VBA loop

    Did you try, as davsth said, turn off calculation?
    Put on start of macro:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and at the end:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Speed up VBA loop

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Select your file and click Upload.
    Close upload window and Submit Reply.

  7. #7
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop

    Thank you davsth! it worked perfectly.

  8. #8
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop

    Yes, thank you! its working now. but it made the sheet [Not responding] when its processing the sheet.

  9. #9
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Speed up VBA loop

    90% of my sheets not responding when I am grabbing data from external sources :-)

  10. #10
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop - for 60K rows data

    it only worked for 15k rows of data, now I'm trying to adapt the same method for 60k data and its running very slow again. is there any other way to speed this up?

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Speed up VBA loop - for 60K rows data

    Untested
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Speed up VBA loop - for 60K rows data

    Hi,

    maybe speed comparison of different objectes can be useful for you:

    https://stackoverflow.com/questions/...yed-collection

    Jacek

  13. #13
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop - for 60K rows data

    thank you, but unfortunately this code does not calculate.

  14. #14
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256
    Quote Originally Posted by reiiling View Post
    thank you, but unfortunately this code does not calculate.
    Formula not support and not responding with large row
    I am has test with 500.000 row
    And code not responding you should be use array or dic like jindon code
    "ThankyouFor Attention * And Your Help!!"

  15. #15
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop - for 60K rows data

    Quote Originally Posted by daboho View Post
    Formula not support and not responding with large row
    I am has test with 500.000 row
    And code not responding you should be use array or dic like jindon code
    jindon's code didn't do anything for me.

  16. #16
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Speed up VBA loop - for 60K rows data

    I have the code below run through 15k rows of data. its currently taking very long time (more than 30mins) to run this code. Is there anyway to speed this up?
    Sorry to say this but i hardly believe that:

    Speed always depend on your PC Configuration.
    check your PC's RAM and Processor capacity.
    Regards,
    MohanS


    "Perfection is not attainable, but if we chase perfection we can catch excellence." - Vince Lombardi

    You can simply say thanks by clicking "*Add Reputation" icon

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Speed up VBA loop - for 60K rows data

    Quote Originally Posted by reiiling View Post
    jindon's code didn't do anything for me.
    Upload a workbook, otherwise wasting time.

  18. #18
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Speed up VBA loop - for 60K rows data

    @ jindon

    Already asked that in post#2 & post#6 dated 01/31/2019.

    @ reiiling

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  19. #19
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop - for 60K rows data

    Quote Originally Posted by bakerman2 View Post
    @ jindon

    Already asked that in post#2 & post#6 dated 01/31/2019.

    @ reiiling

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    The original file is 3MB, I have deleted some data. The "Label" column should be unique serial numbers, I have it as A,B,C,D to reduce down the file size.
    Attached Files Attached Files

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Speed up VBA loop - for 60K rows data

    So, you don't know how to use my code...

    See the attached.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    01-26-2017
    Location
    IRELAND
    MS-Off Ver
    2016
    Posts
    17

    Re: Speed up VBA loop - for 60K rows data

    Quote Originally Posted by jindon View Post
    So, you don't know how to use my code...

    See the attached.
    Thank you jindon for the code.

+ 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. Help with if/for loop [speed up file operation loop]
    By dr.doom76 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-22-2018, 02:45 AM
  2. want to speed up a loop algorithm
    By freak11 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2014, 06:33 PM
  3. How to speed up loop code
    By notreallyIT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2013, 06:07 PM
  4. [SOLVED] Speed Up Loop in VBA
    By PY_ in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-19-2013, 08:57 AM
  5. [SOLVED] Help Speed up this Loop?!?
    By arleutwyler in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-06-2013, 01:49 AM
  6. Speed up a VLookUp loop
    By wizuriel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-11-2013, 07:28 PM
  7. Trying to speed up the calculation my For Loop
    By Astroboy142 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2010, 04:32 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