 Hello everyone and welcome back to another video. The topic for today's video is to be able to capture some information From a user store that said information and then be able to do something with it So the example we're going to look at today is working with an input box So we'll run our code This will then generate an input box will come up on the screen for us or any other user working with the code Where they can input some data and then we can then do something with it We'll be pasting that information into our spreadsheet So it sounds a lot more complicated than it is But in theory is actually a really small piece of code and obviously the benefits of using this along with a larger process Would obviously be very useful indeed So the first thing we've done is obviously what Excel open you see the spreadsheet on the right-hand side here And we've done all F11 to get up the coding panel on the left So the first thing we'll do is create our sub routine. So let's call this sub user underscore info and do our open and close brackets and let's go down So we're about to capture information using something called an input box within our code and What will happen is the input box will pop up as part of us Defining and storing a variable's value. So we'll first create a variable and Was doing like a stick with good practice by actually defining what this is So we're going to find that as a string. So let's say user information as String because we want to gather some text and then we'll see them now want to set the value for this user information So user information and you can pull means call your variable something a lot shorter I've gone and made it harder and made myself do a lot of typing So we're gonna do is go user information and it equals and often in previous examples We've done something like this by saying I put then Someone's name and that is with how we would define that value in that variable But because we want the user to actually be able to input different information. What we're going to simply do here is go input box So nice easy one to remember because you want to gather some input from the user Open brackets and then all we need to worry about here is this first part Which is the prompt and this is simply going to be some text that's going to instruct the user what you want to do So let's put in Tell me something Simple as that close brackets. Obviously, you could put a bit more descriptive question in here like tell me your name That's let's actually change that value make a lot more sense. So tell me your name question mark and Then we can obviously come at the end here. Let's just move these up So we've defined what our variable is so it's a string. It's going to be a piece of text And this is the variable and obviously it equals to the value that is gathered from this input box The next and last thing we then want to do is we want to do something with that data And simply all we're going to do is paste it here into cell one or cell one of column a in our Excel worksheet To do that and we've touched this a couple of times very simply we do equal sheet or not equal but sheets Sheet one so obviously we're referring to that actual sheet. We're using and we're then going to reference the cells So we do cells and it's going to be row one column one brackets and the value of that is equal to user underscore information So that is all the code that we need to work this input box And again, we did go through but just to recap so we're defining here first what that variable is so it's a string a piece of text This is the variable name as you can see there use information and that is equal to the value that is gathered with our input box Once that's been stored or they're going to do is ask our code to go to this cell So the first one here in the first column and simply just eat that value of that cell is going to equal to this variable What we'll do is just to go a bit one more further and tie in something else we've previously learned Let's insert a button. So we go to our developer tab and go into insert and then this top left one here button the crosshair here and Let's do a button there and we can see we've got our range of subroutines available to us So it's going to select user info and Let's go change this text and go gather And again, you can by all means be a lot more descriptive in what you're in your name and conventions But hopefully this does the purpose for this video So you can either run this code from obviously the pane on the left here by either pushing the run button here the play button or hitting F5 But for us what we're going to just do is use this button here. So once you click that button You can see it's going to run the code So it's first defined as a string and it's now I'm going to set this variable and this is where it now wants the input box Obviously us to put a value into that input box So you can see our piece of text here of tell me your name is what you'll see in this pop-up box All we need to then go into here and do is type in pull or any other name that you see fit Select okay, and you can see poor has now been added into that cells value If it to the run this again because we're always referring to this same cell here as being the one what's Populated you'll just get your value will be overwrite overwritten at this point So if you're going to hear now and let's put in someone like Jake For the spell it correctly Jake You can see it's going to go into there and lastly if you do another one Let's do Claire you can see again It will overwrite that value currently or previously stored in that cell So that's how you can simply or really simply get this input box from whoever's using or running the code and It uses this really straightforward It's simply three lines of text or three lines of code So I say in order to achieve that as well a thing I mentioned at the beginning of the video, but obviously this seems quite basic and standalone on its own But as you can appreciate as we start developing more in-depth and detailed processors I'm sure you probably start seeing the benefits of being able to gather various information from a user who's populating this So I hope you enjoyed that video and if you did please don't forget to give the video a like if you're new To the channel or you have previously seen some of our videos, and you're still not subscribed yet Please do hit that subscribe button and also make sure you hit that bell notification button That way you'll be notified of all of our new videos Especially these really important ones as we start to build out this playlist and series on VBA One more thing if you do have any more questions or want to get in contact Simply just drop a comment below this video and I will respond to you as soon as I can Thank you very much and we'll see you in the next video