4.3 Using If-Then-Else Structure Part 1

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
8 hours 33 minutes
Difficulty
Intermediate
CEU/CPE
9
Video Transcription
00:01
you just listen. I will be
00:04
trying to explain to you how to use if the NL's structure. I hope you will get it
00:10
simple so red,
00:12
which would go there directly to
00:17
examples.
00:18
And I have already prepared the macro because the's not crows are getting longer and longer and makes no sense typing them. This one is We're rather simple,
00:28
so I'm just going to first explain to you.
00:31
So this one is called cell Type,
00:34
and let's edit it
00:38
and let me show it to you how it looks.
00:42
So it's where a simple one and it's
00:44
determined to,
00:46
um,
00:48
this this macro is going to determine if the cell a one
00:54
is fixed
00:57
or not.
00:58
So,
01:00
um,
01:03
be open
01:04
the subsequent self type, and then we go directly with it. So if he is
01:11
like you remember, if in Excel it is pretty much the same, only that the syntax is different because now it's a command in the programming language and not the function
01:22
in the one cell that there could be typed in myself. So you say if and then application worksheet function is text.
01:34
This is a function off visual basic for applications that we use an XL.
01:40
It basically gives us true. If
01:45
they're this value we're referring to is fixed and false. If it's not
01:52
so, uh, here we are selecting range a one.
01:57
It means it's a sell single cell,
02:00
a one
02:00
and we ask, Is it true?
02:05
If it is, it will execute what is after then
02:09
And in this case, we're going to get message books.
02:14
This cell contains text.
02:16
If it's not true, so it's not text.
02:21
It will go to what's after else
02:23
and we'll get the message book this cell doesn't contain next, and we'll close it with and if and of course, we close the 17
02:32
and sip.
02:35
So let's just close it.
02:38
And also,
02:39
when you go to Mac Rose and when we go to options,
02:44
you can see that I have a signed control shift A to this macro.
02:51
So just close this and I will press control shift day
02:57
and I get the message the cell contains text.
03:00
Simple is that if I type
03:01
number here
03:04
and breast control shift, eh?
03:07
I get the message this cell doesn't contain next. So you have seen that
03:14
this is a simple, uh, Microsoft Excel Message books
03:19
and it's a default one in
03:24
this function off visual basic, which is message box. And then this cell doesn't contain text. Now, after this, I could
03:35
put some other options
03:38
and it can be visual basic motile exclamation
03:46
and so on and so on and so on. So they're quite quite an option. It will give us the air because I have West left the comma here so we won't save any changes. It's just for you to see how it's functioning. So this is how the if function works.
04:05
Um, in the
04:09
next example, we're going to go to the most more complex if structure,
04:15
but so far, this is it.
Up Next