Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Where For Art Thou DIM?

I have a userform that during initialization, deminsions a number of
variables (as Long). These variables store simple arithmatic
calculations. I need to refer to these variables as the user clicks
certain buttons on the form (i.e. code activated with the on click
event). If the variables are DIMed in the initialization of the form,
how should I call these values within the on click events? I really
don't want to declare them globally as they only are used relative to
this userform (it is actually a subform called from a main userform).
Do I have to pass the variables?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Where For Art Thou DIM?

If they are Dim'd in the Initialize event procedure of the form,
they will be destroyed when that procedure ends. The only way is
to declare them as Public or Private.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GH" wrote in message
oups.com...
I have a userform that during initialization, deminsions a
number of
variables (as Long). These variables store simple arithmatic
calculations. I need to refer to these variables as the user
clicks
certain buttons on the form (i.e. code activated with the on
click
event). If the variables are DIMed in the initialization of
the form,
how should I call these values within the on click events? I
really
don't want to declare them globally as they only are used
relative to
this userform (it is actually a subform called from a main
userform).
Do I have to pass the variables?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Where For Art Thou DIM?

just to add, when you declare/dim them as Private at the top of the userform
code module (outside any procedure), they only exist as long as the userform
is loaded. They are also only accessible to the code contained in the
userform code module.

--
Regards,
Tom Ogilvy



"Chip Pearson" wrote in message
...
If they are Dim'd in the Initialize event procedure of the form,
they will be destroyed when that procedure ends. The only way is
to declare them as Public or Private.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GH" wrote in message
oups.com...
I have a userform that during initialization, deminsions a
number of
variables (as Long). These variables store simple arithmatic
calculations. I need to refer to these variables as the user
clicks
certain buttons on the form (i.e. code activated with the on
click
event). If the variables are DIMed in the initialization of
the form,
how should I call these values within the on click events? I
really
don't want to declare them globally as they only are used
relative to
this userform (it is actually a subform called from a main
userform).
Do I have to pass the variables?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Where For Art Thou DIM?

Got it. Thanks for the quick response.

Reply
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



All times are GMT +1. The time now is 01:09 PM.

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

About Us

"It's about Microsoft Excel"