Hi
What it is doing is taking each sheet's data, and comparing it to the data on all the following sheets. So the outer loop is starting at sheet1, and cycling through all the sheets except for the last one, as the last one won't have any further sheets to cover
It then selects the first sheet.
Now it has to look at all the entries in column A
This has to be compared to all the following sheets, so the second loop covers the sheet selection aspect.
It then tries to find the value from the first sheet in the comparison sheet. I've used the find function for this.
It then tests the result of the find. If it finds a match, it copies the entire row, insert pastes the row after the existing entry, then deletes it from the check sheet.
One thing is that as it puts the subsequent item under the item being tested, the subsequent items will not be in the same order as they were originally found. So in the example file, a is found on all 3 sheets. At the end, the sheet order of the a items will be 1,3,2. To see what I mean, put a 1 in column B against all the items on sheet1, 2 for sheet2 and 3 for sheet3. Check the order of the output.
Hope that makes sense.
rylo
Bookmarks