+ Reply to Thread
Results 1 to 24 of 24

Slow reaction on cell changes

  1. #1
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Thumbs up Slow reaction on cell changes

    I have a relatively complex application with a few thousand cell links and dozens of VBA macros (3.5 MB heavy). This application (one file for each project) is used by a few hundred users in about 200 projects.
    What I did recently (to allow updating macro program functionality in existing files) is to move all macros into an add-in.

    What happens now is every time when I change the content of any cell anywhere in the file, it takes about 3 seconds(!) to leave the cell after changing it and to jump into the one below.
    Of course I'm getting complaints from users about this slow behaviour.

    This also applies to cells in sheets that have no event macro program related to them.
    It applies as well to cells that are not referenced in any other cell.
    I tried changing the calculation method from automatic to manual - no change in speed.
    I de-activated the add-in - no change in speed.
    I have checked if there are any formulas that contain the today() or function or the like - there are none (actually, I had replaced them with links to a cell that contains today's date, which is automatically updated when the file is opened, but this was also this way in the previous version).

    It seems that there is something going on that causes Excel to be busy with itself.

    Does anyone know what might cause this strange behaviour?
    I tried everything I could think of without success and I'm lost now.

    We are using Excel 2003 in an XP Professional SP2 environment and most of our computers have 512 MB RAM.

    I am desperately looking for help!

    Mike
    Last edited by Mike1001; 08-26-2009 at 10:57 AM.

  2. #2
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    I forgot to say that an Excel file that works normally will also work slow when the "slow" file is opened at the same time.

    Also, the template without any user data added also works normally.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Does the file now contain any code at all, or is it all in the add-in? It sounds very much like event code is slowing things down to me.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Volatile formulas are the most likely other cause, but let's rule out one thing at a time!

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Quote Originally Posted by Stormseed View Post
    I guess, you are quite an experienced fellow to troubleshoot OS related issues.
    This isn't an OS issue though?
    Lately I remember someone like you at MrExcel who used to troubleshoot exactly the same way as you do and his name is Rory A.
    Great minds think alike then! (or is it that fools seldom differ? )
    I get cranked knowing more about issues like these for example
    Excel junkie, huh?

  6. #6
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    Thanks for replies, guys.

    I would tend to say that, no, it is not event code driven, as I had set EnableEvents = false and the same behaviour continues.

    As I had said, I had even removed the add-in, and the slow motion continued.

    There are dozens of macros in the workbook, but these are all just small pieces of code which do nothing but calling the macros in the add-in.
    Two "bigger" ones (no more than 50 lines of code) just make sure the add-in is loaded and the other one is the relay function that calls the macros in the add-in and hands over arguments.

    RomperStomper, when the problem is related to complex formulas (which, I have to admit, are contained in this workbook), would one see a delayed reaction even when one changes cells that are not referred to by any other cell?

    What I found out today is that the "new" file with not much user data entered into it has normal speed, but as you enter more data, it becomes slower.

    What drives me crazy is that I really didn't change a lot in spreadsheets at all when I came up with that add-in (just a few user defined cell names on top of those already existing to ensure macros find the correct data), compared to the privious version without add-in and without slow motion.

    What I have seen once in a while is that 'Ready' and 'Calculate' are shown in the status bar at the same time.

    Does that give any of you a hint what the problem could be?

    Mike

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    If you use Volatile functions like INDIRECT, OFFSET, NOW and others, then those functions recalculate whenever the workbook does, even if their inputs don't change. If other calculations then depend on these volatile calculations, you end up recalculating large parts of the workbook for no reason. That can cause exactly the behaviour you describe. For more details see this page (and others on the same site).

  8. #8
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    Yes, this had been a problem while ago, where I had 'today()' contained in about 1500 formulas, but I had eliminated that issue by creating a user defined cell called TDay which is loaded by a workbook_open macro with today's date ('8/25/09', not '=today()') and replaced 'today()' with TDay in all formulas.
    I have quite a number of 'vlookup' calculations across sheets; would you consider those volatile?

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Not volatile, but usually hugely inefficient. I almost never use VLOOKUP and then only if it's a simple two column table. A combination of INDEX and MATCH is preferable, especially if you return data from multiple columns for a given lookup value.

  10. #10
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    I just check the link about volatile functions you provided, RomperStomper. This is very useful information for me - thank you!
    I just noted that I have about 40 cells that contain the 'cell()' function. Would you think that number would slow that application down?

    Anyways, I now have something to chew on! I will have to study that for a while and get back to you with results.

    I do appreciate your qualified and quick help!

    Best regards,
    Mike

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    It's probably not helping but hard to say how much effect they have without seeing it. What are you using them for?

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Slow reaction on cell changes

    CELL is a volatile function.

    There's a UDF at the link that Stomper posted that will tell you if a given function is volatile.

    If you push F9 and see the Calculate indicator in the statusbar, you have volatile functions someplace.

    Amplifying Stomper's INDEX/MATCH suggestion, look at formulas and see if there are expressions that get calculated duplicatively that could be eliminated by a helper column -- like the MATCH part of an INDEX/MATCH.
    Entia non sunt multiplicanda sine necessitate

  13. #13
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    The CELL functions are used to identify to a macro program where the end of a table is (several tables within one sheet where the user can add rows in between). It would be hard to replace them, but it wouldn't help speeding up the application:
    I had replaced all volatile functions by simply writing their results into the cell. I even replaced all VLOOKUPs with their results.
    This doesn't seem to be the fix, as there is no change in performance between before and after replacing them.

    I have to admit that there is quite a number of cell values that are referred to by other cells which are referred to by other cells ... However, this was also in place before I had moved the VBA functionality into an add-in.

    Any other suggestions related to potential root causes?
    Last edited by Mike1001; 08-26-2009 at 04:44 AM.

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Can you narrow down exactly what you added between the two versions. You mentioned defined names so I'd start with those.

  15. #15
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    There were just four additional defined names to identify folder and file name for the add-in file to be copied into the standard add-in folder plus alternate folder and file name in case a user had mapped her/his drive differently.
    The total number of defined cell names is 72 (there is an additional approx. 50 macro buttons with defined names). I have applications with many many more defined names that work way faster.
    Last edited by Mike1001; 08-26-2009 at 05:01 AM. Reason: add info

  16. #16
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    It's not so much the number of names as how they are defined. How/where are those additional 4 names used? And what exactly do you mean by 'buttons with defined names'?

  17. #17
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    I had just added those defined cell names in a hidden sheet that I use for calculations by just using the Insert, Name, Define functionality or directly entering them into the Name Box. Those cells are only referred to by macro code (no cell formulas). Names are like fdMacroFile or fnMacroWkBk.
    The macro buttons with defined names are buttons with macro assignments that I call like btnA7 instead of Button 1 or the like in order to have a stable reference in case of required automatic updates to the file.

  18. #18
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Slow reaction on cell changes

    Oh I see, you just mean you changed the button names.
    I can't think of another reason offhand for the behaviour you describe if it's not to do with volatile functions or event code. (if it were just a question of formula complexity I would have expected the behaviour to be there before, although if you have moved lots of UDFs to the add-in, that might slow things down a little.)

  19. #19
    Forum Contributor
    Join Date
    01-31-2007
    Location
    Aschaffenburg, Germany
    MS-Off Ver
    Office 2013
    Posts
    104

    Re: Slow reaction on cell changes

    After all of your suggestions, I guess I found the reason for the slow file:
    It seems to be linked pictures!
    I stripped my file down by eliminating all remaining macros - performance was still bad.
    I deleted a number of linked pictures - and there we go: performance is back to normal!

    One of the sources for linked pictures was a relatively heavy graph on that particular file, which explains why one doesn't see that poor performance in other files which use less heavy graphs!

    Thank you all, especially RomperStomper, for your advise!
    I learnt a lot about optimizing my applications from that, which will certainly help me in future applications!

    Mike
    Last edited by Mike1001; 08-26-2009 at 11:14 AM. Reason: learnt more

  20. #20
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Slow reaction on cell changes

    I had completely forgotten about that as a potential cause. A few years ago, I had a single linked picture in a workbook to see what was going on in a few cells on another sheet, and it completely whacked performance.

    Going to write that down, right now ...

  21. #21
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    276

    Re: Slow reaction on cell changes

    FYI: One additional situation I ran into now that you can have more than three format conditions.

    I had a 2013 sheet with many rows 200,000+ that I did a sort/delete/resort (faster than filter/delete), and there was three or four format conditions on the data at the time. When I deleted the rows it Swiss cheesed the format conditions and the remaining 100,000+ rows more or less each had their own individual format condition which caused this same "slow reaction after cell contents change even when calculation is turned off" behavior.

    My quick solution was to delete the format conditions via a macro and then manually rebuild them over the whole range instead of individual rows.

    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)

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