D
davegb
I'm working on some code that asks the user via userform to select a
checkbox if they want a certain result. I've publicly declared a
boolean variable bHdr to capture whether they've selected the box
(true) or not (false). I checked to made sure the result of that
selection was passed from the userform code back to the original macro
by putting a watch on the variable in the userform code. When control
passed back to the original macro, the value of bHdr became "empty".
Then I put a separate watch on the variable bHdr in the original code.
It shows the variable having a value "true" if I checked the
checkbox.
I'm confused about this. If the variable is declared publicly, why is
it empty in the context of the userform once it is closed, but true in
the context of the module? What does this mean? Exactly how does VBA
handle this kind of variable?
checkbox if they want a certain result. I've publicly declared a
boolean variable bHdr to capture whether they've selected the box
(true) or not (false). I checked to made sure the result of that
selection was passed from the userform code back to the original macro
by putting a watch on the variable in the userform code. When control
passed back to the original macro, the value of bHdr became "empty".
Then I put a separate watch on the variable bHdr in the original code.
It shows the variable having a value "true" if I checked the
checkbox.
I'm confused about this. If the variable is declared publicly, why is
it empty in the context of the userform once it is closed, but true in
the context of the module? What does this mean? Exactly how does VBA
handle this kind of variable?