When I run your code, I am getting an error value stored in TopEnd as the returned part of the MATCH formula.
What is this supposed to be doing?
Also, in posting this, I realize there was a shortcoming in my help. I never did ask what you ultimately are attempting to accomplish. Often this information will help me give you a better response and may even lead to a simpler way to approach the problem.