You have dim'ed i as a number (integer)
Then you count the numbers of sheets in your workbook.
Then you run your macro on the first sheet.
then your code goes in here
After processing sheet1 (i goes from 1 to the last sheet in your workbook) you call the next sheet with the line
so your code looks like this
This is the loop, the value of i changes from 1 to 22 (if there are 22 sheets in your workbook) So it starts by activating sheet(1), when your code has done its workt the comand "Next i" changes i to 2 and sheet(2) gets activated and your code runs through it and so fort untill all sheets are processed by your code.
Perhps it's easier to understand if you know that the the proper term is
If the part "Step 1" is omitted excel assumes you do want to increase i with 1 each time you call "Next i".
Alf
Bookmarks