|It might depend on how the code ended up in the VBA editor after pasting.|
I just did a copy/paste from my post directly into the VBA editor and it worked fine.
You'll get that error if the complier can't match up an End If to a Block If as follows:
If (this is true) Then (do this)
is not a Block If
If (this is true) Then
(do this too)
is a Block If.
Typically you'd use a Block If to do more than one thing if the If is True, but it can also be used to make the code more readable if the If line is really long. For example, the Block If in the middle of the code I suggested doesn't need to be a Block If, but it would be a really long line and hard to read otherwise.