“The beginning is the most important part of the work.” – Plato
If you are new to VBA then you may be overwhelmed with all the information on the website. Don’t worry – I have written this quick and easy guide to help you get started.
Getting Excel ready for Macros
If you are creating a macro for the first time then you need to spend a few minutes getting set up. Follow the instructions here: How To Create a Macro From Scratch in Excel. Once you are set up you won’t need to do most of these steps again.
Brand New to Excel Macros?
If you are a complete beginner in Macros/VBA then the best place to start is with The Ultimate VBA Tutorial. It was written specifically for the beginner. It is packed full of explanations, activities, code examples and an end of section quiz.
How to Navigate this Website
To see a list of all the posts by category, you can go to the home page(https://excelmacromastery.com/vba-articles).
You can also get here by clicking on the VBA Articles link in the left-hand sidebar(see screenshot below)
This will bring up the VBA Articles page. You can use the search box on the site contents page to search by keyword. You can also filter the website articles using the buttons below the search box.
The sections below provides a brief overview of the important areas of VBA/Macros and what they are about. I have also included the related posts in each section.
Almost everything you do in Excel VBA involves a range of one or more cells. I have written an in-depth post about ranges which starts at the basics and covers all the important things you need to know.
Check it out at: Complete Guide to Ranges and Cells in Excel VBA.
Workbooks and Worksheets
When you perform task that involves ranges, you need to determine the worksheet and workbook to use. There are many ways to access both of these in VBA. This often leads to confusion.
The For Loop
Loops are the powerhouse of VBA. They allow you to perform a massive number of tasks in seconds.
For example, you can read through 10000 rows of data and check each one for a particular piece of text. Doing this manually could take hours.
VBA has two types of For loops: The standard For Loop and the For Each Loop. You can find out all about them here.
In VBA, we have two other loops: the Do Loop loop and the While Wend Loop.
Generally speaking, it is rare that you need to use these in VBA. However, it is good to know about them for when that rare case arises.
You can read more about these loops here: VBA While Loop – A Complete Guide
Subs and Functions
In VBA we place our code in Subs(or the very similar Functions). When most people start with VBA they tend to place all their code in one large Sub. However, by using lots of small subs we can make our code more flexible, more efficient and easier to update.
You can read all about Subs(and Functions) here: The Complete Guide to the VBA Sub
We use data structures to store groups of similar data. They are essentially groups of variables.
If you are completely new to data structures then the post on arrays is the best one to start with. I wrote this post with complete beginners in mind.
Once you have a firm understanding of the above topics you may want to move onto more advanced techniques and topics.
At this point what you need to learn really depends on the type of application you are creating and what you are trying to achieve.
You can check out all the VBA articles by category here.
You can also check out my YouTube channel where I host regular free live workshops on VBA.