Originally Posted by Plan9
I can't recall running into that error personally (but it has been quite a number of years since I've touched VB so I'll have to take your word for it), but it does also sound like your code is poorly abstracted too. I'd look into ways of breaking your code down to smaller routines; that way you can test each sub / function independently of each other and you'd also have less blocks of code you need to analyse. You should also take advantage of Visual Studio's run time inspection tools like watches and break points when debugging hidden errors like those - it will save you having to parse each line manually.
this was VBA, so it was in that goofy interpreter or wahtever you would consider it within MS office apps...it has watches (which i have never used TBH, never thought to really) and not much past that in the form of decent error handling or debugging. pretty much the go to is to create a lot of debug window dumps if you are having problems and sort from there.
though you are right, the code in this case was very poorly laid out..it was one of those things were every time i was finished they wanted to add a little more, which was never discussed so i didnt really have a way to properly plan future modularity or dynamic use...now i am going back and fixing it, breaking it down into smaller routines and functions so its easier to maintain for them when i give it over.