I'm working on project and in the process I'm attempting to build separate Subs for discrete tasks. I'm noticing two behaviors that appear strange and unexpected. I have Option Explicit at the head of my code.
Sometimes, in a 'called' Sub, VBA tells me that a Variable is undefined. However it is in my DIM list in the "parent" Sub. Aren't variable defined in one sub visible to all other subs in a project?
The other problem is that sometimes, as I go from the main sub to another Sub, the value assigned to a variable disappears. debug.print executed before I invoke the sub displays the value, however, another debug.print executed as the first instruction within the new Sub displays a null. Nothing is being DIMed in the new sub.
Is there an explanation for this behavior? Do you need more information from me?
So, far, I've been solving my problems by converting problem Subs to Functions as a work-around but I remain perplexed by the behaviors.
Thanks for your assistance!