Thread: Global Variable
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Global Variable

Above and outside of any procedure in the module, declare the variable
with a declaration like:

Public MyVar As Long

This variable will be accessible from any procedure in any module of
the VBA project (and to other VBA projects that reference this one)
and will retain its value after a procedure terminates.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sun, 26 Jul 2009 05:56:01 -0700, dhstein
wrote:

How can I define a global variable that is accessible to any subroutine in
any module of the workbook? Thanks for any help on this.