Sep 29, 2003 #1 sjh Programmer Oct 29, 2001 263 US Hi, This is a very basic question. In Excel, the variables defined in modules are global variables, right? Thanks!
Hi, This is a very basic question. In Excel, the variables defined in modules are global variables, right? Thanks!
Sep 29, 2003 #2 SQLBI IS-IT--Management Jul 25, 2003 988 GB Sjh, It depends on where they are defined, if you create a module and in the declarations section declare; Code: Public intVariable As Integer This would be global and available to the entire project. Code: Private intVariable As Integer This would be available only to Subs/Functions within that module. Ultimately, you need to ask yourself how visible the variable needs to be and assign it either Public or Private. Hope this helps. Leigh Moore LJM Analysis Ltd http://www.ljm-analysis.co.uk Upvote 0 Downvote
Sjh, It depends on where they are defined, if you create a module and in the declarations section declare; Code: Public intVariable As Integer This would be global and available to the entire project. Code: Private intVariable As Integer This would be available only to Subs/Functions within that module. Ultimately, you need to ask yourself how visible the variable needs to be and assign it either Public or Private. Hope this helps. Leigh Moore LJM Analysis Ltd http://www.ljm-analysis.co.uk