So up to now we've dealt with all the inputs that are less than one, greater than 10, and that are non-integers. We've also dealt with the fact that if they enter text into here, then it's going to trigger an error. An error has occurred. But maybe we'd like to somehow differentiate between the other errors. We want to let the user know that they're entering a string when they shouldn't be entering a string, and we want to differentiate that from the other errors that are occurring. Just to remind you, the only errors that are occurring now are if we put in a string, we do that, it just identifies in a random error, just a generic error has occurred. We want to let the user know that they entered a string and if that doesn't work. In other words, there's no differentiation right now between me typing in a string here and me doing something like canceling. In either case, an error has occurred. So the next thing we're going to do is after we get G, the guess, we're going to check to make sure that it's a numeric value. So it's a number. If it is, then we're going to move along into the rest of the input validation process that we've set up. If it's not numeric, then we're going to display a message saying, what you entered was non-numeric, please try again. And then it loops back up to the do loop. In order for this to work, we have to read in G as a variant. We want it to accept strings, so that we can identify that they have entered a string. Now, what we're going to do is after we obtain G in the input box, we need to take all of this and put it inside an If statement, a two-way If statement which is this G numeric on the flow chart. So, we have IF is numeric that's how we can determine if G is numeric. If that's the case, then we move on with the rest of the input validation that we already to set up. Otherwise, we have an Else statement for if that is numeric is false. We say, your guess must be a number. So that's letting them know that they have to enter a number, and then we move along just as we did previously. Going to step through this, and then if we enter something like hi, which is a string, it's not numeric, so we bump down into the Else and we display your guess must be a number. Please try again. And it loops back up and it still works If I do seven, then that is the numeric. And it's also satisfies all three of those conditions, so we exit to do and we continue on with the game loop, and I happened to guess the right number. So at this point, the only problem that we have is when we bring up the input box, all three of these situations, if you close the input box, if you cancel the input box, and if you just press OK without typing anything into the input box, all three of those yield the same result. So, for example, if I press Cancel, we look down here in the locals window it obtains G as an empty string. So there's nothing in it. So let's deal with this. So now we're going to sort of add in one more thing. If it's not numeric, then we're going to check to see if G is empty. If it's empty quotations, we'll tell them that you can't leave it blank. And if it's not empty quotation, that means they entered a string. So we're going to differentiate between those two. So now we've differentiated. If it's not a number, then we're checking to see if it's just empty. If it's empty, we're going to let them know that they didn't enter anything. If it isn't empty space, then we're going to just tell them that they entered a non number. In either case, we go back and we loop around and obtain G again. By the way, I just noticed this. This single loop up here really should be two loops like this. The one at top should be for the return from the right side of the flow chart. The one on the bottom should be the return from the left side. So now, we've got this. We've converted this is numeric to If then into a multi-alternative. Now I have ElseIf G equals empty quotations, then we let them know that they didn't enter anything. Otherwise, If it's not numeric and it's not empty, then it's we message box your guess must be a number. Now the final issue is perhaps the most advanced. We still are not differentiating between when we run this, if they just press cancel or close. We've dealt with if they don't enter anything and press okay. But right now, pressing cancel and close is responding the same way as if we press okay when there's nothing there. Now we're going to modify it such that it will handle closing and cancelling. And in that case, we just want to exit out of the Sub altogether. See right now, it still is just pumping down into, you didn't enter anything try again, but we want that to just be exiting the Sub altogether. We have one last modification to the flowchart. After we get G, we're going to check to see if it's false. And I'll explain why this is in a minute. We're going to check to see if G is false. If it's false, we're going to exit the Sub otherwise, we're going to move on. So the last modification after we get G, we checked to see if G is false. Again, this will become more clear in a minute. If it's false, we're going to exit the Sub altogether. If it's false, so if G is not false, then we're going to move on, just like we did. So this is the final flowchart. Now let's implement this last little modification. The reason I put this G equals false is because there's an input box function which is shown here, but there's also an input box method. So if I type Application.InputBox, it is the input box method and we can do a couple more things with the input box method. At the end of in parentheses, at the end of the input box, there are optional arguments and you notice when I start typing that in, it tells us the optional arguments. So for now, let's just ignore all the other arguments. The important thing is the last argument which we're going to put a three. A three means, and this is more advanced and you learn about this later on in the course. A three means it can accommodate strings and numbers. And the important thing about using the Application.InputBox method, is it's been designed such that if the user cancels or closes out, the return value to whatever's on the left side of the equality is a false. So let me show you. If we run through this, you also notice that the input box looks a little different from the input box function. If I run this and press F8 and I put in nothing, I just cancel. If I cancel Then you look down here in the locals window, the application.InputBox method has returned false to the value of G. And again, we have to have G as a variant. Also, I can run this and I can just close that button here, close the box and the same thing happens. The return value for G is false. That's why on the flowchart here, I put If G equals false, then we're just going to prematurely exit the Sub. If G is not false, we're going to continue on. So I've added a single line here, If G is false then Exit Sub. If we don't exit the Sub, then we just resume the next and we continue.Okay finally just to clean everything up, I put in a button here and associate it with our guessing game and let's just go through. Let me close the editor. I've closed the editor, so it's all nice and neat. And the editor shouldn't pop up. We've protected it against all of the different areas. So let's run this guessing game. I'm thinking of a number, and let's just do all the input validation, string. Your guess must be a number. Try again. Now, if we just submit it blank, it's going to say you didn't enter anything, try again. If I do cancel, then it just shuts down. If I do close, it just shuts down also. So see how so far it hasn't brought up the editor or any sort of debug box. Now let's check too for the negative numbers. So it says, the guess must not be less than one. We do something that's greater than 10, it tells us that and I think that's it. And now we can play the game. So seven, guess again, and we can keep going. And I'm just going to end there. Okay. Oh! I guessed the number. All right. So this was quite confusing I think to some of you but I wanted to show this. You can maybe use this more as reference. Keep this because maybe in the future you want to do some input validation or try to protect against all of the possible variations in input so we don't end up getting that editor to pop up. All right. Thanks for watching.