I wonder if anyone here could help or explain a strange behavior in Excel 2010! I believe it is a bug in Excel.
In one of my workbooks I had some macros which after running for a while started to slow down (several times slower)!
To make a long story short I striped down the Excel workbook and created 2 really simple workbooks: one runs a macro in 0.25 sec, and a second one that runs the same macro in 3.3 sec. Both have identical macros and identical formulas in Sheet1 (only one Sheet in each workbook).
Moreover, the "Good copy" workbook slows down if the "Bad copy" is opened. Once the "Bad copy" is closed the "Good copy" gets back to speed.
If the Calculation is set to manual then both are running fast (this points to a workbook re-calculation delay).
If in the "Bad copy" I delete the three columns with formulas and I recreate them in new columns, then the "Bad copy" gets back to running fast again.
It seems that Excel will compute only the required cells when a cell changes, which makes sense.
However, in the "Bad copy" those three columns must have something that triggers a new calculation of that workbook every time the VB writes to a workbook even if the macro runs on another workbook! This is very strange to me!
These simplified workbooks contain only one trivial macro (I made them just to isolate the issue):
Sub simple_macro()
Application.ScreenUpdating = False
Dim starttime, taken
starttime = Timer
For i = 1 To 500
Cells(1, 5).Value = i
Next i
taken = Round(Timer - starttime, 2)
Cells(2, 5).Value = taken
Application.ScreenUpdating = True
End Sub
I do not think you can recreate easily the problem starting with a new workbook, so I wish there would be a way to post here the two copies! I was hoping that someone from Microsoft would take a look at the "Bad copy", because this behavior can
slow down anyone's macro without even knowing it! I think I have other workbooks with the same issue.
Thanks for any comments anyone might have!