+ Reply to Thread
Results 1 to 6 of 6

Improving VBA Loop speed

  1. #1
    Registered User
    Join Date
    11-25-2019
    Location
    Korea
    MS-Off Ver
    2010
    Posts
    12

    Improving VBA Loop speed

    Hello all,

    I am trying to improve the speed of my loop macro because my loop macro is very slow to run a large database, over 3000 rows.
    Is there any way to improve my loop macro? I have attached an example.

    I would be appreciated with your help. Thanks.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Improving VBA Loop speed

    1) Put Option Explicit at the top of your module and fix what needs fixing first. It will show when you run your code.
    For instance, no use for "Dim TargetWB As Workbook" if it is not used anywhere.
    2) You set Calculation to Automatic and later to Manual. Should that not be the other way around?
    3) Explain in a concise manner what you want to achieve.

  3. #3
    Registered User
    Join Date
    11-25-2019
    Location
    Korea
    MS-Off Ver
    2010
    Posts
    12

    Re: Improving VBA Loop speed

    Thank you,

    1) I will try to put "Option Explicit" at the top of my module.
    2) I set Automatic and later to Manual because inside the loop needs to be calculated before pasting the results to another sheet.
    3) My goal is to reduce the time. For example, when I tried to run around 2,000 data, it took me 60 minutes to calculate and paste the results. I'd like to ask if there is a better way to loop the calculation part of the VBA and paste its specified (in this case "2020-12-31") results to another sheet?

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Improving VBA Loop speed

    Explain what needs to go where.
    The macro should not be taking any time at all but we need to know what to do.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Improving VBA Loop speed

    The result in the tgt sheet can be achieved just using simple formula . This does not consume any time in processing. Result is also live. If you are interested I will give formula.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Improving VBA Loop speed

    Try this code see if it makes any difference:

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

+ 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. Improving speed of creating pdf
    By karolina1406 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2020, 04:16 AM
  2. 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
  3. Improving the speed of a loop through a date range
    By NorthUnit in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-10-2015, 06:15 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. Improving calculation speed of a sheet utilizing many "sumifs"
    By blademan88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2013, 02:21 PM
  6. Improving Speed of Index and Match Functions
    By hazza147 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-30-2010, 01:05 PM
  7. improving speed and efficiency
    By wishmaker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2010, 11:08 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