Did the routine have anywhere to move back to? What did the debug message say was the Before sheet names.

Include the test for is nothing if you are trying to moveback without first having deactivated a sheet.