OK, I guess Wend = WhileEnd or EndWhile.
It works fine, with the sole exception that I had to comment out the
"Option Explicit" statement because it made the debugger burp.
Something about "invalid inside procedure" or the like. What was
variable y supposed to be for?