Hello and welcome back to another class of our course, but the complete introduction to VBA with Excel.
So in today's class, we are going to have a busy introduction to Mackerels.
And what exactly are macros, how all this works and basically everything that is around macros.
And what we are going to do is that we are going to record our first macros.
So how exactly I want to do this.
Pretty simple.
So we are going to record a basic macro and then we are going to do well, make it a bit more complicated.
So I'll try to make it in three well, in three different examples and basically you'll see how exactly
backwards.
All right.
So basically, what exactly is a macro?
So let's say, for example, that you do the same task the day after day after day after day.
So instead of doing a certain task, you can automate this task directly with the Excel.
So basically, we're not going to write any line of code because basically the macro feature will simply
convert our task into code.
So the only thing that we need to do is simply record a certain task that we want to do on a daily basis.
So pretty simple.
What I would like to suggest you to do as an example is pretty simple.
So what we do at first is we are going to create a small report.
So let's say, for example, you guys are working for a business and this business asks you what sends
you a list of, let's say, names, numbers and numbers to name, age and number.
And basically what you want to do is simply put, all this together.
So you receive, let's say, 10 names per day.
And basically that's pretty simple.
You need to work with those 10 names.
It just do something with.
So what exactly we are going to start with.
So we are going to start by giving a name to our report.
So here we are going to give it a name.
So pretty simple will go to whom will merge the sales.
So here we will have our name.
So we'll name it was just name.
So here will have our name here.
Will have the name of our employees here will have their age and here will have their number once again,
just for the purpose of the example, it's all pretty simple.
So basically then what we want to do, we said we need 10 steps from here, from five to 15.
So basically we are going to receive 10 names per day.
So here will have are some.
Basically, we are going to some of the ages and all the numbers, so pretty simple.
All right.
So this is the first.
Well, the first thing that we want to do is simply to integrate the name.
So basically, what I want to do right now is give a name to my report.
Let's say it's going to be a report.
And I want to have my report looking something like this.
So pretty simple.
I want what my first macro what I will do.
I will simply record how I'm writing a report right here and I want my macro to be right there.
So pretty simple will start with the beginning.
So we are going to make cells.
We're going to go into the development.
So from here, we are going to do we are going to record ourselves well doing this.
So first thing that you guys want to do is simply go on the developer tab and the right here you will
be able to record your macros.
So we are going to record our macro and we are going to name it in this case.
Well, let's call it a name of a report or simply step one, because that's the step one.
Step one, then we want to do is maybe give if you guys want to give it a shortcut.
So basically, the second that you guys are going to write down a certain key, it's going to appear.
So let's say, for example, I want to I want to have my extend that I type control, let's say, OK,
I will have my well, this macro that will automatically run.
But I don't want to use shortcuts.
Then finally, where exactly you want to store it.
So if you store it in this workbook, you will only be able to use it on this workbook.
If you store it on your personal micro workbook, well, you will be able to use it on all Excel files.
So we are going to keep it on this workbook.
Pretty simple.
All right.
So we named our macro step one, so we're just going to click on running it.
The next thing that we are going to do, we are going to go here.
So we are going to click two times.
It's really important and simply select all those while all those things right here.
So all the cells right here then will come back to home and we do what want to do.
So basically we are going to merge the cells and we are going to give in to our report.
So in this case, let's call it, I don't know.
So let's call it the numbers, numbers and names.
Good.
So we have a name to our report now.
We want to put it inside of a table.
So this is exactly what we're going to do.
So here we go.
We have a report that is numbers and names.
Then last thing really important, saving our macros and stopping stopping the recording part.
So right now, we stop the recording.
All right.
So basically what we have just right now is pretty simple.
We have created in macros, so we are going to rerun this macro on this page right here.
So pretty simple.
We're just going to go in on our macros and run Democrat step one.
So here we go.
If we run it here we have our macro.
There is numbers and names.
So pretty simple simply by clicking on our macro, it automatically appeared right here.
So pretty simple.
I don't need all this.
I'll just delete it so you can see pretty simple and pretty cool as well.
All right.
Next thing that I said that we want to do is pretty simple.
We want to continue the creation of our report.
So basically what's going to happen is that we are going to receive names, ages and numbers, and I'm
going to use random numbers to do it.
So don't worry about it.
So what we want to do right now is we want to create what we want to put name on the cell, each on
this cell and number in this cell right here.
Add the sum, put all this inside of a table and calculate the sum of all ages.
So what will be the format of what we are going to receive on a daily basis?
It will look something like this.
So we are going to receive the ABC, the H.
And for the ages and numbers, we're going to use random numbers.
So basically it's a function so random between, let's say one to receive a number that is between 18
and, I don't know, 50.
All right.
Same thing for numbers.
And we simply put everything together.
All right.
Pretty cool.
So right now, we have our numbers and age.
So basically what we receive on a daily basis will be on this format.
So we have absolutely nothing.
And we are going to create the numbers, the name age numbers and then the sum of the calculation.
So pretty.
All right.
Next thing that we want to do is pretty simple.
It's just calculating the sum of all this.
So basically we're calculating the sum of all this.
So we are going to add all this inside of our macros.
So pretty simple.
So right now, let's simply do it.
So how exactly we are going to do this?
Pretty simple.
We are going to record another micro.
So once again, we are going to give it a name.
So let's call it step two.
All right.
Now, what will be exactly in the step to show in the step two?
First thing that we are going to do, we are going to select this top right here and call it name Shirou.
So we have names here.
Then we are going to add this then.
Same thing for the top each.
Age and what we are going to do, we are doing this as well.
And finally, the last chapter, that is the number that will do the exact same thing.
We'll write down numbers and we'll do this the exact same way.
Then what I do is simply go down here.
And do the same thing for some.
So basically we are going to write down some so really important click a few times just to be sure that
it automatically selects itself.
And finally, the last thing that we want to do is simply calculate the sum of all the ages and all
the numbers.
So basically, this is exactly what we are going to do.
So we are going to write down the sum function and calculate all the ages, as well as the sum of all
numbers.
So here we go again, see, it's pretty simple what to do right now is pretty simple.
Just select the cell.
Here we go.
And finally, the last thing that we want to do is simply take all this and put it inside of a table
like this.
So what we'll do at the end will just go in our micro and we'll stop recording.
So if we go inside of our sheet number two, what's going to happen is that we are going to run our
micro.
So here we have our step two.
We run it.
And as you can see, we have automatically a table that have been generated.
So right now we have recorded two macros.
Now, the only thing that is left is simply receiving all the names and all the ages.
All right.
Finally, the last thing that I want to do is create another table that is well, that will look pretty
much the same thing.
And inside of this table, I will have my names and my numbers as well, my names and the sum of my
age and my numbers.
So pretty simple.
I'll do it next to this table right here.
So I'll have my names right there and here.
I will have the some of those things.
So I'll do it.
I'll record the macro automatically.
So pretty simple.
I'll go here and we'll just record the macro.
So I'll click on the recording macro and I will do it.
So here we have our step three.
So pretty simple.
This is exactly what we're going to do.
So here we want our names will be equal to name.
And in this table it's going to be equal to number.
There you go.
So just write down, I'm sure.
All right, then.
The name is pretty simple.
So our name will be equal to the letter that we have right here.
So we have A, B, C until the last name right here.
And finally here inside of this table right here will have our son.
So basically simply equal to this right there.
All right.
Next thing that we want to do is calculate the sum of those two numbers.
So pretty simple.
Will just click on Arcel and calculate the sum of those two numbers.
So basically this one plus this one right here.
And what I want to do next is pretty simple.
Just put everything together.
And finally, last thing that we want to do is calculate the sum of all those numbers.
So once again, right here, what I'm trying to do is just teaching you how the macros work by doing
multiple operations.
Then next thing that what I do is pretty simple, just add some tables because you can see pretty simple.
It's for the esthetic and we put everything like this.
So everything is beautiful right now.
So we have everything that we need.
So what we want to do right now is simply go back here and stop recording.
So right now we'll go on our sheet number two and what we're going to do, pretty simple, just going
to run our macros.
So we'll go here and you want to run our macro number three.
So we have everything that we need right now.
Each time that we receive our names and basic well, each end that we receive our names, ages and everything
will be able to simply run our micro.
So if we copy all the names, ages and stuff and we pass that right here, everything works fine.
So basically we have achieved everything that we wanted to achieve simply with the use of macros.
So if we try it all again, so we'll delete absolutely everything.
Here we go.
We'll take once again our numbers, so let's say the day begins and we receive our numbers right here.
So we just received this and want to do right now is pretty simple, is just running.
Our Macross will go inside of our macro's that are right here, will go with step one, will run it.
So here we have numbers and names.
Here we go.
Next thing I want to run the step number two.
We have the name age and numbers, so everything have been calculated and finally the last step, which
is the step number two.
So inside of our macros, if we're only step number three, as you can see, we have our table right
here.
As you can see, it's pretty simple to understand.
And basically you can automate any tasks that you want simply with the use of macros, which in my opinion
is really amazing.
So right now, guys, you know how to create your own macros and automate your own tasks without even
coding in VBA.
So pretty simple.
So that's a task that goes into all in our next class.