Today I've written my first useful macro in Excel VBA. I've had past experience with Visual Basic (a long, long time ago), and it's a simple language, so the code wasn't difficult to craft. What was much more difficult is understanding the required methods and properties of Excel's VBA objects. The macro dresses as a function (which you can fill in a cell with =func_name(params)). It receives a range, and computes a "special" sum of the elements in it. The sum is special because sometimes the elements are added as they are, and sometimes they're doubled, depending on the text in the adjacent column. This is far from rocket science, but I'm satisfied because in this case Excel is definitely the right tool for the job, and having the ability to code simple macros greatly enhances its usability.


comments powered by Disqus