LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Confusion about context of variable

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?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable type Confusion D Zandveld Excel Programming 2 March 5th 07 09:07 AM
ISNumber - What Context? ronaldo444 Excel Worksheet Functions 1 August 14th 06 04:59 PM
Context menu cmpcwil2[_27_] Excel Programming 4 June 14th 06 12:11 PM
context for the command bar Eric[_27_] Excel Programming 1 February 2nd 06 12:40 PM
Context sensitive help Jon Bailes Excel Programming 2 January 14th 05 01:19 PM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"