Hey guys, welcome back. So in this video, we're going to see how we can affect cells positionally within a range. Okay, so what does that mean? Well, basically, you can use the cells collection object to affect a certain cell within a range. And what that means is that you can select a range of cells. And you can say that you want to put a certain value in the fifth cell, for example.
So put the value of 100 in the fifth cell, for example, and you can make it in the sixth cell in the seventh cell and the 10th cell if this range contains 10 cells or more. Okay, so how do we know what the fifth cell for example within a range is? Or how does Excel determine that and how does the counting happen? Does it happen from left to write or from top to bottom and let's say that you finished the cells within a line in a range or in a row in a range. Do we make the cell below it the next cell? Or do we start from the very left on the new row?
Or how does that happen? Well, basically how the counting works is that we start counting from left to right. And then when we finish one row, within a range, we start counting the following cell from the following grow with from the very left, actually. So this is how the counting works. So we finished the cells in that row. Let's say that the range is from a one to D seven, for example.
So if we want to get the sixth cell, for example, so it would count 1234, and then the fifth is actually cell a two and then it's cell B two, basically, this is the sixth cell with within that range. Okay, so let's have An example basically, let's say I write cells, eight dot value is equal to 100. Okay, and when I write cells and then I write only just eight, between brackets, what that means is that I'm actually counting eight cells, starting from cell A one because I'm actually selecting all the cells in the sheet and I'm starting to count eight cells, and the first cell in the sheet is actually cell A one. So this is going to count 12345678. So it's going to be put in cell h1, basically. And remember, guys, when we were speaking about how we can determine which member of the collection we select, or we deal with the beginning of the course, and we actually put that example for sheets, and we were writing sheets, a dot activate, for example.
So So we said that he will actually select the eighth sheet. Okay, but the problem is that the sheets could change position. So this is not a good way to select sheets, but in case of the cells, the cells will not change positions. So this is not going to cause an issue. Okay? But anyways, you probably won't do that for all the cells, you probably do it in a certain range, but this is just an example.
So actually, what is gonna happen in this case is that it's gonna put the value of 100 in the eight cell in the cells collection objects is gonna count 12345678. So if you run that, you can see here that cell h1 has acquired the value of 100. Okay, so let's have another example. Let's say we right range a one to D 12 cells 15 dot value is equal to 100. Okay, so whereas range a one to D 12, this is actually range a one to D 12. So what that is going to do is that it's going to put the value of 100 in the 15th cell within that range.
So the 15th cell is going to be 1-234-567-8910 1112 1314 15. So it's going to be cell C four. So if you run that, you will see here that cell, c four has acquired the value of 100. Okay, guys, so this was how you can affect a cell within a range depending on its position. So this is how you can deal with a certain cell within a range depending on its position. I haven't needed to use that a lot.
But in case you need to use it, or in case you read it in somebody else's code, you'll be able to understand Stand what that means. Okay, so thanks guys for watching and I'll see you on the next one.