Hilary Rosen, welcome back to another class of our course about the complete introduction to VBA with
Microsoft Excel.
So basically in the past few classes, we talked about coding and basically we wrote some lines of code.
We tried well, not we tried.
We wrote down macros.
We wrote our own macros.
And not only our own macros, we actually created macros, our macros.
We went inside of the code of those macros.
So we did pretty much a lot of things.
And what I figured out is that I didn't talk too much about everything that is inside inside of the
code.
And this is exactly what I want to do in this class.
So it's going to be a little bit more theoretical and we are going to talk about each part of the code
and what exactly we can find when we are writing VBA code.
So what I propose you will what I want to talk about are basically a few fundamentals of the VBA coding.
So we're going to talk about modules, about procedures.
We want to talk about some other stuff, such as statements, objects and classes.
So those things, in my opinion, are really important to understand.
Yes, it's going to be a little bit more theoretical.
But once again, in my opinion, it's really important to understand all of those elements.
So let's start.
All right.
So what exactly we can find when we are writing a VBA program or even a code.
So basically, first thing that we can find, we can find modules.
So we talked about it at the beginning of the scores.
Two modules are the place where we can store our macros to where the macros is going to be stored.
We can see them as the warehouses are for what we can see as the warehouse for modules.
So basically, this is well, there's a little mistake right there.
What I want it to mean, we can see it as a warehouse for macros.
So basically macros go inside of modules.
So basically we can store a lot of macros inside of modules and it's composed of procedures.
So to understand it, basically modules are the place where the macro is stored when it's created.
So in other words, we can see it as a warehouse where all the code is going to be stored.
So basically, well, normally or well, a standard module will be created with a set of procedures.
So macros and procedures as well.
So now it's time to understand what exactly is the procedure, because I always said that while there
are macros inside of procedures, I will.
Well, there are macros inside of modules.
So basically what exactly is a procedure?
So we can say that a procedure is basically a part of a computer program used to perform a task.
And in VBA we have two of those.
So we have some procedures and function procedures.
And for the sub procedure, we can, for example, what we can, for example, think about that, the
sub and function or the sub sub and procedure.
So to understand a little bit better, basically a procedure is part of a computer program that is used
to perform a certain action.
So if we talk about that, about it, in other words, we can say that a procedure is a block of statements.
Both are included by a particular declaration statement and an end statement.
So, as I said, sub and statements in Libya, there is two types of procedures, as I said.
So the first thing will be the sub procedures that are used to perform an action in Excel.
So in other words, the declaration statement that will begin in a sub procedure will be a sub, so
is a sub at the beginning of a sub procedure will be a sub procedure.
Well, it's sorry.
So basically, we have our sub and and sub at the end.
This this is a statement, but this could be a sub procedure as well.
So we can, for example, think about the first and last sentence of it, because, as I said, that
starts with subs.
So this can be an example of a sub procedure.
And finally, the second type of procedure is a function procedure.
So finally, a sub procedure do not return a value, but a function procedure can perform certain activities
before returning a value.
So now we are going to talk about what exactly are statements, because we talked about procedures and
we talked about a little bit about the statements.
When we talk about procedures for when we're talking about statements, we can divide them in two things.
So, first of all, we have our declaration statements and our executable statements.
So I'm going to explain it.
Well, just just really basic that first and then I'm going to go a little bit more in-depth.
So basically, the declaration statement is as written right there.
It's really used well.
It's usually used to declare a variable or a constant and finally executable statement will will be
more a specification of something.
So if we talk a little bit more in depth, so basically, as I said, the declaration statement will
be usually used to declare something like, for example, a consonant or a variable.
So we can, for example, think about the sub procedure where we can find a declaration statement in
the opening of the sub statement that will declare this procedure.
That is our market.
So basically, we have our set procedure and then we will have the name of our magpul, basically.
This will be a declaration statement that we declare the name of the macro as being the name of the
macro.
And the second thing will be the executable statement.
So basically this statements are the specification that a certain action has to be taken.
So basically it's to perform a search well, to perform an action or a certain type of action so we
can, for example, think, well, we have a few examples for.
So basically a simple example of this type of statement can be, for example, select or in other words,
asking Excel to select some cells.
So this would be a statement and an example of statement that can be used in your vehicle.
And we use it more than once in the past few codes that we have written.
All right.
Next thing that we are going to talk about right now will be the objects and there are huge part of
our world, basically of our Web programming.
And what exactly are objects?
It's like it's well, it's the same thing as written right there.
It's to describe a certain action that will be performed.
So basically, we can say that an object is simply a certain action that will be performed on itself.
So in THEBA programming, we work with plenty of different objects.
We can, for example, think about the things that we have right there.
So we have, for example, workbooks, worksheets.
We can have some other ones, like, for example, salvages cells and many other different objects.
And for example, if we thought, well, we can talk about a few of them that we have used in the past
few classes when we wrote our programs so we can, for example, think about the active cell and deselection
cell that we have used.
So if we look at our code, we used those two objects.
So the first will refer to the current active cell in the current active workbooks.
Right now we're talking about the active cell and deselection object is simply a reference to the current
selected object.
So basically, this would be for our object.
Finally, the last thing that I want to cover would you guys will be the classes.
So basically classes are a huge part as well of feeB Will.
Basically, all the things that we talk about are huge parts, but classes are also really important.
I'm not going to talk too much in depth about it because it's a bit more advanced.
But in my opinion, it's also important to understand what exactly art classes.
So basically classes are the element that defines objects.
So in other words, how exactly we can see what we can say, that classes will define some aspects of
an object so we can, for example, think about what we can think about a few things that can define
an object.
For example, the properties of the object be variables or the procedures that are used inside of a
certain object.
So when we're thinking about a class and an object together, we can say that this means basically one
thing.
So you can think, for example, that an object is an instance of classes, or we can simply say that
classes are a blueprint.
So basically classes.
Well, there is a lot of classes that are part of one single object.
So that's pretty cool to understand.
So what we talked about in this course today are basically the basics of Excel that are, in my opinion,
really important to understand.
So first of all, we talked about modules that are a huge part of Excel and basically we are using them
to store macros and procedures as well.
We talked about what exactly is a procedure and how it works and basically what exactly is a procedure.
We talked also about statements, objects and finally classes, so this course, today's a little bit
more theoretical because in my opinion, this is really important for us to understand all those elements
that are inside of feeB programming or if you guys want to program in debate and even if it's theoretical,
well, it's really important to understand those elements as well.
So that's a first class guys, all in our next class.