Learning VBA for getting Excel work done fast

I've been recently picking up another programming language: Visual Basic for Applications (VBA), specifically for working with Microsoft Excel.

I'm not going to be coding any hobby projects in VBA any time soon, but it is useful for a few specific things. Basically, VBA is good for automating things within Excel, so if you find yourself needing to do anything within it, VBA could give you some extra power if you already have a programming background.

My first taste with VBA came from my current employer, where it is used often in their spreadsheets. VBA can be used to used to script normal user actions, which is the kind of coding I first encountered, but this can often be slow if working with large amounts of data, or doing some external file I/O. Using my more conventional programming tactics, I produced some very large gains in macro execution speeds. I'm now getting requests from co-workers to speed up some more VBA code they have, so I'm feeling pretty good about myself there. And I have only been programming in VBA for about a week now.

The skills I have been picking up were immediately useful in school, too. My psychology professor is using Excel spreadsheets for storing participant data for a class experiment we are doing. Since we need randomized positions for the objects we use in our experiment and there is no set upper limit on how many participants we will have, I used the magic of VBA I've been learning at work to just add a new spreadsheet in the workbook, already populated with a new random trial setup, whenever we need another one. Put behind a button, it is very simple to use by anyone. The professor was impressed, so I guess it was a success.

There are some things I did find annoying about VBA, like its use of GoTo statements, the lack of simple functions for shuffling data randomly or converting between arrays and cell ranges, etc. But programming languages are tools, and each one has its own intended purpose. No single language is good for everything. Keeping that in mind, VBA has been quite useful for automating several tasks I need to do both at work and school, as long as we keep using Excel at both. And it's yet another skill I have under my belt as a software developer.

Popular posts from this blog

Setting up my custom domain with GitHub Pages and Google Domains

Fun Run 2: Tips, Tricks and Strategies

Live sample of an inheritance scam: A dissection