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: 298
Default Public variable (or Public Const?)

A variable, once assigned a value, should keep that value as long as it's in
scope.
Provided of course you aren't doing anything like calling "End"...

If your variables are losing their values then something else is going on,
which is difficult to diagnose without your code.

Tim



"Brettjg" wrote in message
...
I have my main workbook called "1. FINANCE" with six sheets in it. About 10
other workbooks run off the main one doing diffrent tasks. I've set up a
Public Variable in a normal module in PERSONAL.xls and set FINbk (whick is
1.
FINANCE) and all of it's sheets such as F_PERS etc. This code works as it
should, and the variables are set when FINbk opens, and are cleared when
it
closes.

However, it seems to me that the Public Variables do not retain their
values
after a run of a few macros. Does that mean that I should be using a
Public
Const instead, and if so won't I get an error msg when I try to set it for
the first time (1. FINANCE is the master name but when I do a run it has
the
client's surname attached "1. FINANCE Walkenbach.xls"

Just wrapping my head around the whole Public thing (never did care much
for
the General Public :). Regards, Brett



 
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
Public Const & RowSource Karen53 Excel Programming 4 November 30th 07 08:13 PM
Public Const to refer to a range name TimT Excel Programming 1 August 23rd 06 08:14 PM
public const availability? lcoreyl[_22_] Excel Programming 5 July 1st 06 04:22 PM
Public Const on a Drive MD Excel Programming 1 July 15th 04 03:53 PM
crash changing const to public const BrianB Excel Programming 0 August 4th 03 10:13 AM


All times are GMT +1. The time now is 09:51 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"