hi there. "J" is simply a variable name that is created by the user. it can be "abc" or "xyz". it doesnt matter. if i have a lot of variables, i like to give it a more meaningful name for me to amend the code more easily. for this case, i might want to call it "SheetX", because my variable is going to be a loop from 2nd worksheet to the last worksheet.
"On error Resume Next" is for the next line of code, which is:
so if this above code encounters an error, it will skip this code and resume to the next line of code. i am not that good in VBA though, and i can't think of a scenario where this will run into an error because there is always a first worksheet.
"Sheets(2)" is not referring to the worksheet name, but the 2nd worksheet in your file. you would have a 2nd worksheet because of the code:
Line 8, as i mentioned similarly above is not referring to the worksheet name, but the 1st worksheet in your file.
Line 9 is the loop i mentioned in the beginning which will start from 2nd worksheet to the total number of worksheets in the file
hope that helps.
ps: jindon covered it pretty well, but i might as well reply since i have written a bunch of it
Bookmarks