Hello,
First, let me say that I'm new to this forum, so please forgive me if I make any mistakes...
The problem with my Excel macro is that sometimes it runs fast and sometimes it runs slow. Specifically, it alternates among taking 15 seconds and 45 seconds--of course, I want it always to take 15 seconds! The execution times alternate predictably: first 15 seconds, then 45, then 15, then 45, etc. It doesn't matter if I save the file between runs; it still follows the pattern until I close & reopen Excel.
The part of the macro that causes the variation is a copy-paste action. The macro copies a large range (16,845 R x 66 C), and then does "paste formulas" with "skip blanks." I need to use "skip blanks," which is why I can't simply use Range("new").Formula = Range("old").Formula.
During this action, the activity bar in the lower-left corner of the Excel window says "Cell:" and shows a FULL progress bar. It seems to hang at this point (when the progress bar appears full).
Before this action, the macro performs about 80 smaller copy-paste actions. I have tried using VBA to clear the clipboard before and after the problematic code, but it doesn't seem to do anything. I don't think it's a clipboard problem anyway, because the fast/slow variation occurs when running the exact same code on the exact same data.
I'm not going to attach the file, because it's over 40 MB!
Any help would be tremendously appreciated...
Thanks,
David