+ Reply to Thread
Results 1 to 4 of 4

Extremely Slow Macros

  1. #1
    Registered User
    Join Date
    03-26-2021
    Location
    Birmingham, Alabama
    MS-Off Ver
    Office 2016
    Posts
    7

    Extremely Slow Macros

    I am a complete novice when it comes to VBA. In fact, I am completely self-taught in Excel, which means I tend to do things via recorded macros when I can and as soon as I find something that works for my issue, I stick to that.

    A little about the file: I work in manufacturing and have created my own file to calculate machine load and capacity. The original file works alright. Then I made a second file which is inspired by the first, but has more options to it.

    The original file only calculated by annual volume for 4 years from one source of volume data. (300 tools across 32 machines)

    This new file can have one of two volume sources (Projected or Customer Given) and shows 8 years of data, either annually or quarterly. This one has a quarterly load and heat map, as well. (Also 300 tools across 32 machines)

    I have code that works in the new file, but it runs insanely slowly. My guess is that is because all my macros, graphs and calculations interract with multiple sheets.

    In the attached file, I scaled a lot of things down so that I can upload:
    Program codes from 25 down to 4
    Quarters & Years from 2021-28 down to 2023-25
    Machines from 32 down to 4

    That sped it up a TON, so I think the problem may be my massive quantity of data... So here is the question: Is there something I can do with my macros, given the stupid way I set this up because I don't know VBA (or really any appropriate Excel methods), that will help speed this up when I go back to 8 years and 300 tools? Or am I just out of luck because this comes out to several thousand data points?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,077

    Re: Extremely Slow Macros

    There doesn't appear to be anything inherently slow in your code, and there isn't much code anyway.

    That puts it down to the volume of calculation. At a rough guess, there must be 10,000+ calculations in your sample. Not especially complex but the majority seem to have full column references which makes life easy but is generally bad practice and inefficient.

    I would recommend that you review every formula and change the full column references to specific ranges. Ideally, set up dynamic named ranges though, to be fair, that is a lot of work. Probably best to start with static ranges that will exceed the maximum likely useage, but which will be significantly smaller than the full column, and see if that improves the situation.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Extremely Slow Macros

    I'd note that there are links into another workbook. If that workbook were closed and there were lots of formulas referring to ranges in it, that sort of thing can slow Excel to a crawl.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extremely Slow Macros

    It's not usually particularly obvious with small sets of data, but conditional formats are volatile meaning whenever the workbook calculates they will automatically be reevaluated.

    I can see you do have two sheets full of Cond. Formatss. If this is a cut down version and the production workbook has many more rows with CFs then that will no doubt have an effect. An obvious test is to remove the Cond. Fs in a copy and see what happens to the speed,

    There is a less elegant way of using Custom Formats to colour cells and custom formats aren't volatile

    Here's a link if you need to consider this.

    Custom formatting
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. Excel extremely slow now
    By bittah.wanderer in forum Excel General
    Replies: 4
    Last Post: 08-31-2020, 11:33 PM
  2. OFFSET functions are making my macros extremely slow
    By amros in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2017, 03:25 AM
  3. Extremely slow macro!
    By PSm1th29 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2010, 06:27 AM
  4. Excel is extremely slow now
    By Martindelica in forum Excel General
    Replies: 0
    Last Post: 05-01-2007, 08:32 PM
  5. [SOLVED] Extremely slow file
    By Jay in forum Excel General
    Replies: 3
    Last Post: 07-10-2006, 08:19 AM
  6. Macros making file saving extremely slow.
    By Donald Speirs in forum Excel General
    Replies: 1
    Last Post: 01-20-2005, 07:06 PM
  7. Macros make file saving extremely slow.
    By Donald Speirs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2005, 02:06 PM

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