Im using VBA with excel to do some routine totaling of large amounts of data that come in every month in more or less the same format...
While im writing the code im also testing it to make sure it runs smoothly, but, once i write a function and test it it goes REALLY slowly. One time I got kinda....bored...and ctrl+alt+deleted to end task. When i reloaded the SAME file (had saved just before testing and ending) it goes signifcantlly faster, like ~30x faster.
My question is, why does it do this and how do i make it do that WITHOUT having to EndTask and come back.
NOTE: saving and closing out the file doesn't work either.
Hmm.. strange choice Marty! Moved to Office Development
EDIT: Lost all my formating, sorry.
To keep formatting you need to use VBCode tags - either using the button in the post editor screen, or by putting them in manually, like this:
[vbcode] 'code here [/vbcode]
(I have added them to your post above).
I'm afraid there is nothing obvious in your code that could make it slow down when being re-run, but then we can't see much of the code you are using (in the other functions, like detExlCol) or the sheet itself.
If you can post the file (put it in a zip file, and click on "post reply" then "manage attachments") then we can probably work out any issues.
(if you cant show us the data, it would help if you could give us "fake" data instead)
So what you are saying is that when you EDIT your existing code (or adding more to it) and then test it...it runs slower unless you force the program to close and re-open? Or is it when you run the code more than once?
If you find any of my posts of good help, please rate it
For some reason I couldn't find the VBCode button the first time around (I was looking for it), I see it now though.
The problem:
(It got weirder over the weekend, I swear this is true)
When I open the file for the first time the code runs (measured by how fast the individual cells fill in) at "1x". If I Ctrl+Alt+Delete while the code is running the re-open the same file and run it again it runs much faster ~"10x" at least.
Now, I have discovered while doing the Ctrl+Alt+Delete, that if I just hold Alt down while the code is running I get almost the same results without the impromptu ending for the program. Here is the bulk of my code.
Don't hesitate to criticize this code! I'm a newbie at programming so I’m sure it’s not as "optimized" as it can be. Also, there are probably many functions I have forgotten about that were either for test or are for some other parts of the program.