I do not see anything wrong with the code.
Could you perhaps attach a sample document where it will not run?
How to attach a screenshot or file in this forum.
You may want to look into using the debugging tools built into the editor.
VBA: How to Debug Code - Overview, Tools, Shortcut Keys