Playing around with VBA

My current job has me working with Microsoft Office products on a daily basis, using Excel/Word/Outlook (and Access too… *shudder*) to get things done.  There’s been lots of times where I thought, “There must be an easier way of doing this”, and lo and behold, there was already a function built in to solve my problem or someone much smarter than me figured out a workaround and posted it online.

Then I thought, “Boy, I wonder how much functionality this thing really has to offer.”  So I went searching and found a course on Coursera that taught Excel and VBA.  I signed up, and have been expanding my skills ever since.

I figured this would be a good spot to upload some of my fun programs, not only to show people that I can program and show off my progress (of which I hope there is some), but also so that people can play around with the programs and maybe find some enjoyment in them too.

So, the following are the programs (currently only one but my hope is that the list expands), with a short description about them.  Enjoy!


  • Lottery Example – I wrote a little program that would either take 6 unique numbers (from 1 to 49) that you enter, or a random set of 6 unique numbers (again from 1 to 49), and determine how many times you’d have to play the lottery before you got all 6 numbers right.  Based on current 6/49 prices for the WCLC (at $3 a play), it’ll also tell you how much money you would have had to spend to get the win.  Somewhat sobering.  Make sure you allow macros – if you trust me that is.  Always use your best judgment when downloading things from the internet.  Also don’t be scared if, when you run the program, your Excel software freezes up – it’s doing a lot of calculating so that is to be expected.  It’ll work. 🙂