8 hours 33 minutes
Okay, let's look now at what happens when we click the command button.
we're looking at
sub this macro
and what first thing we do. And you see that I haven't done the dim statement here. It doesn't have to be because thes air just
plane integer print plane, the string or in number Constance.
So I'm just doing this so I could ah,
simplify this line here. So I'm saying row number is sheets, answers cells 11 and look at the here.
So this is this is number here that that tells which is the active
Ah, ro. And you see here the answers I have given So
So the routine that starts the whole thing, that one. When we click, start the tests puts here number three,
and there they put a different number, but you'll see how this thing develops. It doesn't matter. So
the call number six you see here has left from the last question.
so Cole number is this cell,
and then we have three simple questions. So if option button value one is equal true, so it wants quick, then answer is one.
If it's too, then answers to if it's treated and it's straight. So if which we determine which one of these trees through and then we decide what is the number of the answer. And then we just put in these sheets answers
in cells, roll number three and
call him number. The last one was six,
and value is answer. So
this is it. It can be 12 and three. And here it was three.
And then I'm just typing this me that high. So when you click the command baton and it does all these calculations, it will hide itself so it will remove itself from the screen.
And, uh, that's it about this form. So this is a ll the cold you need in the form to do this.
Let's just close this because we're no longer looking at the form.
And now let's look at first. The module one
and module one is, uh,
start test module, which is the most important one.
It's also where a simple
So what we're doing is we're saying, for I equals 1 to 5 because we have five questions. So if it would have 20 questions, it would be from my was 1 to 20
and then we're just telling column is Ah,
I plus one.
I plus one. Yeah, because it's called Miss my Policeman. But basically, what we do
is we're saying sheets answers cells
cells 12 So row one cell too.
I plus one?
It could be calm. Yeah,
it's okay. So this is
and we're saying that it is I plus one. So we start with column to counter goes from 1 to 5. So it goes like this.
Uh, we could have set it to be a different one, but it could have been from 2 to 6. But
it's just much clear because you have 20 questions. You don't have to remember to say 2 to 21. You just put here the numbers so we could have also automated this. So we count the number of cells with the do loop. But
this is this is just the example.
And in the questions in cell 11 we are putting too. Why? Because here, if we put two ah, then ah,
the routine knows to start from two and is goingto be questioning line two then three, then Ford and five and then six because I's going from 1 to 5. This is going from 2 to 6.
And now if you look a tw what we're doing,
we're just doing user forms show. And this this unload user form is actually not needed. So I'm going to delete it.
And I have written the code also so that this con number is also needed. So I'm going to delete it. I'm just showing you what happened when I was developing it
on. It's important for you to see that you can't, you know, almost never right this cold from the scratch. Correct. So there is always something in the process that
put some lines there that they're not really needed. They're not influencing the functionality off micro, but they make problems. So basically,
this is it so and then we
tell next I envy insects. So what is? But this is doing it is calling five times this form and then in the form we have code, which, when we click on submit, will find what the answer is and put it in the answers line here.
And let's go back to this so that you see this as well. So we can we can save this one for later so you can review it.
And let's look a module three, which is basically a sub that collects student name.
So we have dimension. Answer this string and we're saying answer equals input box. Enter your name. So you have seen that input box in which he should be. I answered my name.
so in this box,
thes books can also be modified
because if I start typing here,
I get the sums of, like, exposition y position, help file contacts, whatever. We don't need that.
We just need the plane input box. If you want to do that, you can go toe, excel, help, or look the answer online. How to make your input box look different.
But this is it. So we're setting the counter to zero after that. So we got the name in the in the variable answer,
and we do a do loop which says, first, we increase the country to one
and we simply go loop until sheets
answers. So, in the answer sheet in cell I one which is this one or this one or this one, depending on the
we find the empty cell. So we ran out off filled lines with students answers because this can be done with four by multiple students as well.
And what we do now is that we put
answer which his name in the cell. So when I was typing this, this line was empty.
So it counted 12 and then three, and the 3rd 1 was empty. There I was, three at the moment. Eso in cells I
and remember, when you're using the cells
command, then it's row first and call next while where you using ranger using the standard X L C five or a three. So it means Cone first and then wrote
and also after replaced the name here. The second thing we did is that we told the functions later, which is the row in which to put the answer. So basically, when you click on the submit button in the form, it knows that the current row is three.
So it's, uh
look at this
and that's it.
we did the loop. We found We replace these numbers and sell and we ended sub. So this one just places the name and tells the later functions what would be done. So if student clicks several times on the enter your name,
It would put several instances off that student's name here, but this would remain empty because then we would tell the the other Mac Rose that
this, for example, if you put it twice, it would be distant. The number here would before this line would be empty. So the teacher would know that this student has just clicked on input name and input their name several times more than once.
So this is, uh this is how this macro works
and this is pretty much it. So you see, Okay, you can admit crows to hide and on high dances and questions what you can also do. Let's just close this and close this, um, you can also hide these
so that they are not visible when manipulating the
answers and questions and so on and so on.
And you, when you hide everything, get just this one sheet, you can protect everything with passwords. So this stone just clicks the name so you can put some instructions here. Like, for example, one
full name in
is you make
when and to ring
so we'll have the empty line
on and so on and some And then to the number two is
You are ready.
First button and
And what also we can do here is that
we can large this cell.
We can select the cells to weaken forward them so that we wrap text
auras until is left,
and vertical is center
on. We did this
on. We can increase the text size
so that, uh,
this will do. We can then
the height of these gums.
No little so that it looks nicer.
Yeah, And, uh,
or whatever you think it's ah is appropriate.
So we have here a typo,
but this is it. So this is finished.
Product will save it.
And that is end of this example