This is moving rows between several sets of sheets, rather than just 1 sheet to another. For a larger set of sheets, whether that be more elements in the set or more nodes on a path, I would use an array approach, rather than just the strict IF() statement. This approach is commented out on the script.