Hello,
Is there much overhead involved in VBA classes? I noticed that on a previous workbooks I effectively did the same thing as what's currently in my classes, but it ran faster.
Hello,
Is there much overhead involved in VBA classes? I noticed that on a previous workbooks I effectively did the same thing as what's currently in my classes, but it ran faster.
Hi Jake,
To answer your question, there is a little overhead with classes. Namely the creation and destruction of those objects. Also accessing properties can be a wee bit slower. But generally speaking, it should be a fairly negligible amount. You really shouldn't see any difference at all unless you measuring in milliseconds. A more likely culperit is the way the code is now structured. I would advise stepping through the code and observing what it is actually doing. It could be possible there are things you can do to optimize the code.
To give an example: If you have a property that performs a look-up on a value that won't have changed consider having the first access of that property lookup up the value and store it for future reference. So any calls to that property thereafter don't have to perform the lookup. If you think the data may change, consider using a refresh method, or an optional refresh parameter.
This example may not apply to your specific situation, but you get the idea. You might consider posting your code and asking for help making it faster.