 Hello everyone and welcome back to another video. So this video is going to continue from our last one in which we had a first look at VBA in Excel. So if you haven't checked out that video, you might want to do that quickly now before watching this one because it will be beneficial from some of the topics we covered. But in this video, we're going to start looking at how do we reference a cell within the Excel workbook and therefore how do we place some information into that desired cell. So it won't be a too long video. We're going to do each of these videos. Hopefully it won't be no longer than 10 minutes each with each video with a dedicated topic. So without further delay, we'll jump straight in and yeah, as I said, just to give you a bit of insight, each video will gradually build upon each other so that at the end of it, we can all tie that information together and actually start doing some interesting functions and obviously really building out some time saving techniques for using VBA in Excel. So what we want to do is we want to go into our VBA window so we can do Alt and F11 and I'll just bring that over to my screen here and what I might also do is just reduce the size of this just so we can get everything on one page. So you should actually develop a window there. Perfect. So as you remember from yesterday's video, we're going to do our code within a module. So let's go insert module and you can see we're now in there. So what we're going to do here is we want to input some text into cell A1. So for us, that's this first cell here in the top left hand corner. In order to do that, we're again going to store this or store the code within a sub routine. So we're going to enter sub space and then we need to name what this routine is going to be called. So for us, we'll put some text. So very original title there and then enter the two brackets so the open and the close, hit enter and that will automatically populate that end sub for us. So we know we need all our code to be within these two lines here. I'm just going to always indent just because it makes it easy for reading the code back. So in order for us to reference that cell, so cell A1, there's a couple of different parameters that we need to use. So we first need to tell the code what sheet we are wanting to put information in and within that sheet, what range or what cell reference do we then also want to populate? So what we'll do is the first thing we need to do is define the sheet. So that's very simply just put in sheets, so sheets like that and open brackets. And then from within here, we can either enter the index. So what is the number that is relevant to this particular sheet? But what we're going to do again, just to make sure this stays nice and clear and it's easy to read, we're actually going to just label the sheet name. So for us, that's going to be sheet one. And what we need to do is put that in within quotations because this is actually a string or text that we're actually going to enter into this. And string is a type of a variable and obviously it defines the context of the information you're putting in. And what we'll be doing is covering these in a bit more detail in another video. So don't worry about those terms just yet. So what we need to do is enter in here sheet one, close up quotes and close our brackets. The next thing we now need to do is define the range or where that cell reference is. So what we then need to do is do a full stop. And then we can now type in and we'll do two different methods for doing this. But the first one we'll do is range. So just type in their range and open brackets. And we then need to do another quotation. And this is simply going to now put in here the actual cell reference. So for us, by using range, all we need to do in here is put in the a one within those quotations and close up brackets again. So so far we've got our sheets and that obviously refers to the sheet name. The next part is the range which is referring to the cell reference. So at the moment, if we ran this command we would be able to get Excel to select that cell but actually we want to put some information in there. So we're just going to do one more full stop. And we're going to say that we want to actually populate a value within that cell. So all we need to do here is go value equals and another set of quotations. And then now within these quotations we can type in here what we actually want to populate into that cell. So for us, we're going to simply put into here hello world. What is the text we used in yesterday's video? Well, yesterday it was when the video came out but that's what we used in our previous video with the message box. But this time we're going to populate into our cell. Once I've entered that information, we can then hit enter and you can see it's formatted the text for us. And by that I mean, let's give the capital on the sheets, the range and the value. And when it does this, it's a good way or good indication that the information you're entered is correct. And basically the VBA has understood the information you're putting. So if we now run this and just a recap, we can even put this green play button here or as again indicated when I hovered over there, we can hit F5 and that'll then do it for us. So if we hit F5, you can see we've now got hello world populated into cell A1. If it had changed this text, so we go in here and we go hello everyone and run that again by pushing S5, you can see that it's automatically gonna override that for us as well. Alternatively, if we want to now change where that is going, we can simply go into here and we can change this to now an A2. So if we to do that and hit F5, you can see how it's now gonna move into cell A2. So this is a really simple way of being able to populate some information into your given cell reference. Another option we have for doing this when referring to a particular cell is we can actually go in here and do it very similar, but instead of using range, we can put the actual cell reference and using the actual numbers to identify the row and the column. In order to do that, we do sheets again and we want to go sheet one and this time we're gonna use cells. So we go cells like so and open our brackets. And then this time what we need to do is we just need to put the numbers that identify the row and then the column that we actually want to populate information into. So for us, if we wanted to do cell A or yeah, cell A1 it's simply gonna be row one, column one, close brackets and that's the same way of referring to cell A1. Next we then just need to do dot value equals hello again, I just put something in here that's different so you can see it's changed, hit enter. And then what we'll do is let's change, yeah we've got A2 there, it's gonna do hello everyone so we'll see it's gonna change. So you can see it's now populated that as well. So all you need to do when it works with the cells reference here is you just need to keep changing the row and the column number to reference the cell that you want to populate. This can sometimes be easier when you're working with dynamic calculations as we'll get on to later when you want to perform a calculation to define what column or row you want to populate. But alternative to that, this first row here of the range A2 and the other cell reference you want to refer to is a really good way, especially when you get started as it's quite clear and indicates to you the cell that you're trying to populate. So that's everything we have planned for today's video. So suggestion would be take that information, have a play around referring to different cells within your sheet, just so you familiarize yourself with the code and obviously you get comfortable with populating information within that sheet as well. Obviously we reference sheet number one here but you can enter any sheet that's in your applicable workbook. And obviously if you were to change the sheet name, so it changes the sheet two, you also need to remember to obviously update this sheet reference here to be sheet two as well. Else you're going to get the error and it's not able to find your sheet. So that's everything we have for today's video. Do not forget to subscribe to the channel and make sure you hit that bell notification button. That way you'll be notified of all of our future videos in this series that are coming out. And lastly, if you did enjoy the video and that gave you some insight into using VBA, please do give the video a like. It's not only greatly appreciated by me but it helps that all important YouTube algorithm as well. So thank you very much and we'll see you in the next video. Before you go, don't forget to check out the other videos on our channel. You'll see everything from other functions and formulas through to tips and tricks. We've also created some playlists so you can see these categorized together. So make sure you check those out and get all those useful information. And obviously as always, don't forget to subscribe and hit that bell notification button.