+ Reply to Thread
Results 1 to 5 of 5

How to speed up writing to cells with VBA??

  1. #1
    Registered User
    Join Date
    05-08-2017
    Location
    Paris
    MS-Off Ver
    2013
    Posts
    35

    How to speed up writing to cells with VBA??

    Dear experts,

    I am desperately looking for your help. I have a code (below simplified) with around 20 "checks" that need to be done per each line found in the excel worksheet. The problem is that each ''check'' can have different results, therefore I am doubting whether an array would work. I believe the code is slow due to interaction with the worksheet (writing back each cell separately).

    Below is a very simplified portion of what I try to do. In reality I loop over 100k rows with 20 criteria to be written in different columns.

    Is there any way to speed this up?

    Thank you very much for you kind help!

    Bundi

    Please Login or Register  to view this content.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,309

    Re: How to speed up writing to cells with VBA??

    How is the data initially been written to the sheet ????
    See big yellow banner, workbook would be more useful.

  3. #3
    Registered User
    Join Date
    05-08-2017
    Location
    Paris
    MS-Off Ver
    2013
    Posts
    35

    Re: How to speed up writing to cells with VBA??

    Thanks torachan, you are right. I have enclosed a very basic function of what I need. Due to very limited cells it seems to run fast, but in reality with more conditions and rows it takes long. If in my real macro I disable all the writing to cells, it runs fast indicating the issue is there.

    Thanks in advance for your time!
    Attached Files Attached Files

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,309

    Re: How to speed up writing to cells with VBA??

    Had a quick look and seeded with upto 500,000 rows and run timer, it was 20% quicker just using a simple loop instead of arrays.
    This is the sort of sorting that @Jindon would apply a 'speed of light' solution to if he has read your posting.
    The attached is how I quickly looked at it, clear column 'C' and seed 'A' with 10,000 or 50,000 or 100,000 or 500,000 rows.
    Your procedure is still on its original button, my simple loop is on button 'LOOP THRU' both are on a simple timer.

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

    Re: How to speed up writing to cells with VBA??

    In reality I loop over 100k rows with 20 criteria to be written in different columns.
    It will take time...
    For the file you uploaded.
    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. Need to speed up writing INDEx MATCH formula
    By hkbhansali in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-20-2018, 08:07 AM
  2. How to avoid cell SELECTION but still format cells to speed up the macro running speed
    By BeefyBerts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2018, 08:18 AM
  3. [SOLVED] How do I speed up VBA code that clears cells
    By Bobbbo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-03-2017, 07:05 PM
  4. [SOLVED] Speed up writing to a worksheet with a for loop
    By demarc in forum Excel General
    Replies: 3
    Last Post: 04-09-2015, 03:06 AM
  5. Everage Speed km/time (european speed)
    By GerryZucca in forum Excel General
    Replies: 3
    Last Post: 02-23-2015, 03:02 PM
  6. Skipping blank cells tp speed up a loop
    By jerrydiaz in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-14-2014, 07:58 PM
  7. Optimizing memory, speed: Arrays vs. Cells, etc...
    By T_o_n_y in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2006, 04:15 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