ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Static global varibale - where tu put it? (https://www.excelbanter.com/excel-programming/437310-static-global-varibale-where-tu-put.html)

Mac

Static global varibale - where tu put it?
 
Hello,
I need to initialize a couple of objects on a sheet just once upon
Sheet.Activate event; I'd use a bool varibale as a semaphor so that further
inits would be prevented if a user returned to that sheet from another one
and this semaphor would have been set to true. Now - where should I put this
variable for it to retain its value throughout the 'lifetime' of the whole
workbook?

Jacob Skaria

Static global varibale - where tu put it?
 
--These variables are to be dimensioned at the top of a module like
Public blnSheet1 as Boolean

--For a clear picture on this refer the below link
http://www.ozgrid.com/VBA/variable-scope-lifetime.htm


--
Jacob


"Mac" wrote:

Hello,
I need to initialize a couple of objects on a sheet just once upon
Sheet.Activate event; I'd use a bool varibale as a semaphor so that further
inits would be prevented if a user returned to that sheet from another one
and this semaphor would have been set to true. Now - where should I put this
variable for it to retain its value throughout the 'lifetime' of the whole
workbook?


joel[_335_]

Static global varibale - where tu put it?
 

Use a Dim statement in a module or Class module out side any sub or
function


Dim A
sub Test
A = 5
end test


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=161663

Microsoft Office Help



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com