Slow "comparison/replace" script
@whatsup, its very cool to use the .Exists method of a Dictionary Object as a super efficient search. But I cant seem to see where you populate the Dictionary. I cant see a loop where use use .Add to poke the contents of your array in there. How does that work?
Another point I would add to your solution with regard to speed, is to always use the Value2 property of the Range Object instead of the Value property for bulk read/write. There are overheads associated with type conversions in the Value property which are not present for Value2. The later just blasts the literal bytes across without abstraction.
The final point I would make is that there is no need to set local objects to nothing at the end of the sub. This is less efficient than letting VBARuntime do it for you, which it will. It also clutters up your code.
VBA uses reference counting to manage object life cycle, so if there are no references to an object then its deallocated from memory and this inherent process is much more efficient than setting objects to Nothing. As a further note, setting a global (Module level) object to nothing does not release it from memory if there are still other objects referencing it.
|