Quote Originally Posted by Jacob Roman
Switch the Wend with #7 and End If with #8

And if you have learned to indent your code, it wouldn't be so confusing:

Now you know which one it corresponds with
I agree