Excel Automate Using VBA

Visual Basic Excel Tutorial

How to Automate Repetitive Tasks in a Spreadsheet - Free tutorial - freecodecamp.org

I use VBA, or Visual Basic for Applications, to automate my repetitive tasks. This saves me quite a lot of time in my day-to-day life.

Based on the fact that you're reading this tutorial, I assume that you would like to be able to do the same.

So I will take you through the basics of VBA, such as how to use variables, loops, if-else statements, arrays, and dictionaries.

Visual Basic Excel Tutorial

Intro to VBA and Overview of the Project

Although VBA was declared legacy in 2008, this implementation of Visual Basic can help you automate the repetitive tasks in your daily life.

The language is object oriented, it's written in C++, and it includes all the features you would expect in a coding language these days.

In this tutorial we will be writing a macro that prepares a template to note the temperatures in several European cities – Amsterdam, Barcelona, Berlin, Brussels, London, and Rome.

The template will be automatically created by a macro we build together based on the cities and date that we use as parameters.

Finally, we will also learn how to import the data from another file in our template.

In order to follow along with this tutorial, I expect you to have a basic understanding of Excel. But you don't need any experience with VBA (although it might help you understand the different concepts I'll introduce).

I have downloaded several Excel files of data which are free to use. You can also find them on my GitHub together with the final result.

Let's Define Our Parameters

First we will define the different cities that we will be using for this tutorial. If we were to do this manually, increasing the number of cities would consequently mean more work.

But in our case, since the macro will do the work for us, we can add as many cities as we like. Then we'll just run the macro and go do something else.

In order to define the cities, we can do one of two things. Either we can include the cities in an array in the code, or we can define them in a separate worksheet in our template.

For this tutorial, we'll be doing the latter, which makes it easier for other people to add cities later on without any knowledge of VBA.

Access the tutorial



Our task is to centralize the largest number of courses, training, tutorials, videos to make it easier for you to search when you want to train.
Generally, we incorporate those that are free, but if we find some interesting ones that are paid, we add them so that your training is more profitable and professional.
Keep training yourself to become a better professional or simply for personal achievements, cheer up, don't give up and go ahead !!!.
Good luck !!! The team of: