4.5 Using Complex Macros with Real-Life Problems Part 6
8 hours 33 minutes
Okay, let's continue
this macro for the sales competition.
We stopped here, and we have found in this loop
the maximum value for
maximum sales price for chair and max themselves for rice for table. So we have these two values,
and now we're going to look
who meets these requirements.
So we're going to do again one do loop. And also it's going to be until
range of A and I is equal.
Nothing. Because then we have gone through all the files
yeah, before that were again going to set the counter to two because we don't need it anymore.
I mean, we we we don't need it here so we can use the same counter. So I will be counter again.
And now we're going to do through grow
and see if the sales price
is equal to Max Price chair.
So let's say if
the price is Aaron called e so e
So if it is equal,
then what we do?
the name of the person.
Now, this is G three,
and we have to set first the counter
share. So here we will say, S C C equals three.
And as C table
equals three as well.
we're going to this look and then we say
looking for chair. So it's for chairs G.
So it's G
you're looking for the sales person. So its range
and stopped value.
But here that you also just to make sure that this is
and then we just do.
so, we have closed this one,
we have no else. So if it's not,
it can mean that the air in the row where the prices for table
or that it is so we're not going to think about it. And now we're going to copy this room again because we don't need to type everything.
And here we're just going to change with me be changed. So
yeah, If Max Price stable, is it
value off e
I? So it's a
this and then
the range is
now it's a CD,
and it's equal
Nice that Sorry good value.
Also, what we forgot here
is to now increase the counter off sec. So if this has happened, we added something.
and we're going to do that
the same here for a city. So a city equal the city Waas one
and we're going to do.
and just to make this fully
I'm going to do this.
So we have closed.
Well, you check this line.
And so if his metric
it's put here the capital aged just
you ever think
and what we're doing now
is we're saying I equals eye plus one. So we're going to the next
and then we're going to
the same thing here.
We're just going to copy this
and who would present there?
And we have closed us.
So we have
gone through row after row with this loop
we checked. If
we're in this line, the price is equal
to make surprise chair.
And if it is, we'll just write that name into
wieners off the chair.
we're going to do that
because in every line we can have either chair or table.
We still do this
checkups. But we know that it cannot happen that in single line we're going to have
more than both entries
entered in Combs, G and H.
We're going to close
while actually, we would save it.
So we're saving this
and it should work.
So we're going to close it.
We've been too close. We should basic
it becomes this
and we're going to sign macro, which is going to be our micro winners.
And we just
quick in here
and you see, we have a
and let's just see what's wrong.
Yeah, I have placed here s CD instead of a C t.
So it's a typo
and we're going to change it.
you could save change.
So everything else was check sec. Is cssc
a city? A city is a city.
It's closed this
into hotels that
the beggar is closed.
Let's click again.
this here We also have a
check again. What? The air is
They're looking if a
we have for gotten puts the range here
and now it should work perfectly
because it went on and on and on because
A and I
should have bean false or true and
that that's that's not happening. So this is not correct. And we should put here well, you
Just to make this fully correct
to see type something, you make a few mistakes quick here.
Save it. So this is how this debugging process looks.
And let's close this
and click here
and everything Is that so if we delete this just to make sure that they're working is working fine.
So we have just been down here on Mike here,
and yes, these are the pillars,
and it works perfectly. So this is how you make a macro for something that looks rather complicated. But when you look at the code, it's quite simple. It just needs in practice.
Now, just one more thing for this module. I'm not going to give you any,
uh, exercise files. This has been exhausting enough,
and I believe that you can now do your practice by yourself, just going there and write some simple Mac Rose and get
acquainted with special basic for applications, excel and how it's done.
And thank you for listening