Viewing 13 posts - 1 through 13 (of 13 total)
  • Speeding up excel vba
  • mrmo
    Free Member

    Is their any way, missing comments etc. to get a vba script to run a bit quicker? The one I have is reasonably quick but because of the size of the worksheet it is taking a while!

    molgrips
    Free Member

    There could be, but it depends on what the code does!

    It’s like asking how could you make a novel shorter.

    5thElefant
    Free Member

    By far the cheapest approach is to buy a better PC (assuming this isn’t for personal use).

    soma_rich
    Free Member

    Get a better vba programmer…
    Get a better computer…
    Turn off everything else on your computer.
    Probably in that order to.

    mrmo
    Free Member

    It is a two condition lookup, find match in column one, look in column two for a second match. Small detail is comparing two tables with 10000 rows each. I need to find rows that don’t match.

    soma_rich
    Free Member

    How are you doing it?

    molgrips
    Free Member

    That sounds like it could be significantly optimised. How are you looking for things?

    Oh, and you say ‘tables’ – I presume you mean worksheets?

    Don’t delete comments!

    Turn off screen updating while you do the heavy lifting (and turn it on again afterwards).

    Megatron
    Full Member

    2nd turning off the screen updating, seems to slow things right down. (to me) it always looks magical when the end thing suddenly appears on the screen 🙄

    reggiegasket
    Free Member

    can you do it in Excel, rather than VBA?

    soma_rich
    Free Member

    Sounds like 2 vlookups would work. But I think 2 collections in VBA would work quicker.

    stumpyjon
    Full Member

    Junk the looks ups, use the vba to run down the columns until it finds a match.

    Another way of massively speeding up the code in a large workbook is to switch off automatic calculation when the macro is running. Obviously if the macro is using the results from a work book formula this doesn’t wotk so well although you can get the VBA to calculate the results for a specific formula as part of the code. Don’t forget to turn the automatic calculation back on at the end of the macro. If the macro crashes don’t forget to turn it back on manually.

    footflaps
    Full Member

    its faster to use worksheet functions, called from VBA, than to implement them yourself eg worksheetfunction.vlookup etc

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Speeding up excel vba’ is closed to new replies.