I'm new to VBA. I'm finding myself obsessing maybe too much about processing time. I totally understand the obvious things, like operating on addresses/ranges/variables/arrays rather than in active cells, etc.
Here's an example. I'm going through a list, filtering by several different variables to generate a list of part numbers that I'm going to feed into another system (mainframe...). I started creating these tools for a coworker when I knew very little, so all my macros have been pretty piecemeal. Now I'm streamlining...feels very inefficient to totally redesign everything, but when I started I didn't even know what I mentioned in the first paragraph.
So here's an idea, I was going to use an array to hold a list of numbers. Now I figure I will make it a 2D array so I can also hold the inventory quantity data I plan to get from the mainframe. While redesigning, I figure I'll also use this array to record whether this part is listed multiple times in my tracking excel file (which some are, and which is not up to me). I could use an array column for this, or I thought of a random "new" idea: make the part number negative in my array if it's used multiple times. Then later, check each number for <0...
As a newbie, jumping in and programming before having much experience, esp. in VBA, I'm constantly worrying about things like this, always aware that there's probably an alternate way, and always aware that if I worry about it too much I can't actually GET TO WORK, yet if I hastily get to work, then I'll wind up wanting/needing to change it later.
So, what do you guys do? Should I stop worrying? Should I keep worrying, do short tests to see how long stuff takes? In your experience, have you found that your upfront nitpicking about methods have resulted in long term (per-run) savings? Or no?
Bookmarks