The macro is working with the sample file you sent and not with real one, is it?
Can you prepare a test file (with dummy data) reproducing the issue?