Hey guys, welcome back. So in this video, we're going to speak about the cells collection object. So the cells collection object is a collection object that allows us to deal with cells, just like the range object. However, we do that in a different way. Because instead of providing the name of the cell, like a one, a two, B, one, B two, C three, we actually provide the row number and the column number for the cell, because the intersection of a certain row and a certain column would give us a cell, right? So this is how we deal with the cells collection object.
Instead of providing the name of the cell, we actually provide the row number and the column number for the cell. Okay, so let's have an example here. So let's say I write cells and then I open in brackets, okay, and you can see here, we've got two inputs, the row index and the column index. And actually they are both optional because you can see the square brackets around them. However, we actually need to input the row index and the column index, because this is the only way to refer to a certain cell. And even though they are optional, they need they need to be inputted because if you don't input them, then you're referring to all the cells in your sheet.
So for example, if I write cells, dot select, with or without the brackets, this will actually select all the cells in my sheet as you can see here. So back to our cells collection objects. So if I write cells, one, comma two dot value equals 50. So this will actually put the value of 50 in the cell that is In the first row, and in the second column, that means is going to be cell b1. So if you run that, you can see here that cell b1 has acquired the value of 50. So basically, as you've seen here, we needed to specify which cell we needed to deal with, because the cells collection object contains all the cells.
So when you use it, if you need to deal with a certain cell, you need to actually specify which cell you are dealing with. One more thing I'd like to tell you about the cells collection object is that you're dealing with cells, just like what you were doing when you were using the range object. So actually, most of the methods and properties that we've explained when we were explaining the range object are actually going to be applicable to the cells collection object as well because at the end of the day, you're also dealing with With cells, right? So because both the range object and the cells collection object, they deal with cells, they will have the same methods and properties. Okay? So someone would ask a question here.
If the cells collection object does the same thing as the range object, which is dealing with cells, why would we bother to learn about it? So actually, in the future, when we learn about variables, which are basically containers of data, so each variable can contain some data. And this data could be a number. You could have a variable x here in the row number in the cells collection object or the row index. And this variable could have its value changing, especially if you're using a loop for example, and a loop is basically you can think about it as laps around a track or rotations or Round the track. So in the first rotation, the value of x could be one.
And then on the second rotation, the value of x could be two. And then on the third rotation, the value of x could be three, and so on and so forth. And actually, when the value of x changes, this means that you will be dealing with different cells, right? Because cells, one comma two, is different than cells, two comma two, and that's different than cells, three comma two, right? So when the value of x changes the cell that you're dealing with changes. So basically, the fact that the cells collection object except numbers, and you can plug in variables in the cells collection object, this gives it a lot of power.
And this will be clear, actually, as we progress through the course and when we reach the variable section when we explain variables, but I just wanted to highlight the power and the potential of the cells. collection object it is truly powerful. One more thing I'd like to tell you about the cells collection object is that you can actually input the column index as the column letter. So instead of inputting the number for the column, you could put the letter for the column. So for example, if I write cells, one comma C, but you actually need to write the letter in between double quotes, this will refer to cell C one. Okay?
So if I run that, you can see here that cell C one has been given the value of 50. Okay. Okay, so that's it for the introduction to the cells collection object. We will speak more about it in depth as we progress through the course. Thank you very much for watching this video and I'll see you in the next one.