Alright, so I’ll get laughed at here, but one of my ‘goals’ for work this year is I wanted to take the 4 hour VBA course on youtube and then write a small program after it that does something.
Before you laugh at me using an outdated language, I only chose it because a co worker suggested learning it, and we do use some VBA coded macros in our spreadsheets. We’re not a very up to date company.
The reason I never get anything done with learning programming is I never know what to do . And if I do come up with something to do, it will be WAYY too complex over my head, i’ll fail at it, then never touch it again. If it’s too simple, I won’t even want to bother. (Yay ADHD)
So I’m just looking for a couple suggestions for a fun little program to make (and consider the goal ‘done’). I know calculators of some sort are an option…I can’t really think of anything else. I guess it doesn’t actually have to be a useful program but it would be cool if it was.
Here’s an idea:
- find a Excel workbook you / your team uses a lot.
- use VBA to add a button onto the main sheet labeled something like, “Lock”.
- when someone clicks it, that sheet gets locked from edits (“protected”) and the label on the button changes to, “Unlock”
- When Unlock is clicked, the protections are removed
A couple of notes:
- practice this on a COPY of the sheet you all rely on
- know that VBA has a ton of really odd things about its language – things that no other language (that I know of) does
So learn as you go, build up your confidence, but keep in mind that not everything you learn will apply to other newer languages you might eventually learn.
Have fun, be patient, ask for help whenever you get stuck!
At work, if you already have an existing workflow or process that’s repetitive and you have some level of familiarity with, start with that. You will already be clear about the outcomes you want.
VBA is nice in that since you are manipulating an Office product (usually Excel), you get to see what your code actually does in “real-time”. Running the code line by line (Debug mode IIRC) helps.
Don’t worry about it being “old”, it’s still useful in most corporate settings and like others have said, much of the concepts are transferrable. Myself I went on from VBA to other Microsoft products like Power Query and DAX.
One word of advice, always work on copies! Treat VBA processes as destructive and non-reversible!!! Last thing you want is to mangle “live” files beyond repair…
Have fun :)
I taught myself VBA when I inherited a job that involved taking data from multiple sources and producing summary reports of various types for multiple stakeholders. The person before me spent days each week doing it, it took me about a week of learning and playing to bring that down to 5 minutes or so.
I found VBA useful for dealing with administrivia.
I ended up doing similar things multiple times afterwards, with variations on source data (excel, text files, word docs), source data location (local drive, network, databases, SharePoint) and output (pivots, charts, tables, text files, email, word docs, etc.) depending on what was needed. Someone else mentioned data validation already.
Automate the boring stuff.
I wrote some VBA for a job a long time ago. It was pretty good for making quick and dirty UI in Excel – like, click a cell and have it pop up a form you can interact with that will let you do data entry with less clicks/typing than whatever Excel would’ve made you do if you had to do it naively.
I used it for showing a list that could be filtered down by partially typing in text in one project. (A really basic autocomplete sort of thing, essentially.) For another project, I integrated IE and showed some complex data in the embedded browser with buttons (or maybe it was checkboxes? been too many years) in the form to quickly classify it and move on to the next entry without having to flip back and forth between multiple programs and manually open files. (Each entry corresponded to a row and widgets on the form updated values in various columns so I could go through all the data and fill out the full spreadsheet super fast.)
Alternatively, write a script that checks your spreadsheet for errors. e.g. add a reference to a regex library and use it verify that all the entries in a column match the data format you expect (like serial number patterns with hyphens in specific places).
You can also ask your coworkers for something tedious they have to do a lot in Excel and see if you can find a way to make it less tedious.
You can always look for an existing Office-based process that is tedious and manual, but fairly mindless.
Learning one language makes it easier to learn another, so dont worry about which one you start with. Basically the “language” or vocabulary changes, but the underlying “grammer” (as in noun, pronoun, subject, adjective, etc) is for the most part universal. Like knowing what a library, functuon, method, class, loop, variable, etc will be transferable.
For a project, I dont know what you do for work, but you mentioned vba macros in spreadsheet, so id recommend building off of that. As someone else with adhd, the more interested I am in something, the more motivated I am in pushing through roadblocks when its not instantly easy. So id recommend trying to automate some task you do manually for work, something you know a lot about and know what the inputs and outputs should look like, and write something for that.
The traditional first program for a language is one that displays the text “hello, world”.
https://en.wikipedia.org/wiki/Hello,_world
A “Hello, world” program is usually a simple computer program that displays on the screen (often the console) a message similar to “Hello, World!”. A small piece of code in most general-purpose programming languages, this program is used to illustrate a language’s basic syntax. Such a program is often the first written by a student of a new programming language,[1] but it can also be used as a sanity check to ensure that the computer software intended to compile or run source code is correctly installed, and that its operator understands how to use it.
https://riptutorial.com/excel-vba/example/13182/hello-world
Now, you might want to do something more-elaborate too, but maybe make that the second program rather than the first.
VBA can be used in place of scripts on Windows through the use of
wscript.exe, so you might want to find any small thing you want to automate and figure out how to do thatHey man, someone’s gotta learn VBA! It’ll probably outlive both of us, if Microsoft keeps it around in any capacity.
I’ve never written any Visual Basic (A or otherwise) but I was under the impression that VBA was just for extending functionality of existing Microsoft Office applications, no?
Which of these are you interested in using?





