I'm going to continue to work with this Worksheets - STARTER file that's on the course website. In sheets two through six, I've got a bunch of information, a bunch of data here, just some integers, a six-by-four on each of the sheets. And what we're going to do is we're going to iterate through the worksheets and we're going to iterate through the ranges and count the number of sevens that are in the workbook. So, the total number of sevens in the workbook. And then, we're going to take that result and either display it in the message box or maybe write it to sheet one of the workbook. So, I first wanted to start out making a flowchart for this. We're going to enter into a For loop, we're going to iterate for i equals one to nw, where nw is going to be the number of worksheets. So, we're going to have to Dim over here, nw, we're also going to, at some point, have to Dim i, and we're going to have another couple of variables. We're going to have j and k, and we're also going to have the number of columns and the number of rows, all different things that we're going to have to Dim. Also, we're going to have a counting variable that's going to count the number of sevens, so that's going to be c. These are all going to be integers. Once we're done counting the sevens on all of the worksheets, then we're going to output c, which is the count, the number of sevens in the entire workbook. Inside each worksheet, we're going to iterate through the range. So, we're going to iterate through that range on each spreadsheet. I'm just going to say that nr is going to be equal to six, and nc is going to be equal to four. But you could count that if you wanted to, if it was variable. So, we're going to iterate through all rows. In each row, we're going to iterate through all columns. And here, I just say four, but in my code, I'm going to use nc. And then in each cell of our range, we're going to check to see if it's equal to seven. If that's true, then we're gonna add one to our account. If that's not true, then we're not going to do anything. And then when we're done for each worksheet, iterating through the range and counting, then we're going to do is we're going to bump up to the next worksheet and we're going to do that for all of the worksheets in our workbook, and then when we're done, we're just outputting the total count. So, let's go ahead and put this into VBA. I'm going to create a sub called CountSevens. I've dimmed all the different variables. Now, in this approach, I really don't need nr and nc because I can just put those directly into the For loop, but I'm going to do this anyway. I've defined what number rows and number columns are. I'm counting the number of work sheets. And I actually just noticed an error. Because the first worksheet does not have any information on it, in other words, sheet one doesn't have anything. We're just starting at two, going from sheet two to six. And really, what I should have here is i starts at two, so that should be a two right there. So, let's go ahead and implement the first For loop. So, this is the i index that iterates over the worksheets. For i equals two, to the number of worksheets. Now inside each worksheet, we're going to enter into another For loop which will be j. Inside the j For loop, we have another For loop which is iterating over k. So now, inside the innermost For loop, this is where we're going to see if the cell of our range is equal to seven. Each of the worksheets has the same range that we're searching over,sSo that's going to be C5 through F10. So, inside the inner For loop, I put this line, "if range C5 to F10.cells j from k equals seven." Then we're going to add. So if that's true, then the count is equal to count plus one. We found one more seven. So, we're going to go through all of those. We're going to iterate through all the columns and rows of each of the sheets. We're iterating through all the worksheets through index i, and then at the end, we're going to output c and I will just put this in a message box. So, let's go ahead and see if this works. I'm going to press F8, so we set the number rows, number columns, as six and four. We're going to count number of worksheets. That's six down here in the Locals Window. Then we can iterate through. So now, we're on worksheet two. So we're on sheet two, and we're iterating through. We don't find our first seven until we get to the second row. We see down here in the Locals Window, we've added one to our count and it looks like it's working. So what I'm going to do is just put my cursor down there and run the cursor. There are a total of ten sevens in our workbook. And finally, we message box that. Alternatively, you could write this to the spreadsheet. Using something like Worksheets1.RangeA1 equals c, and then when we do that, I just ran it using F5. I switch back over to sheet one, and we put the result there. So, hopefully, this screencast gives you a better idea of how we can iterate through worksheets.