View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Global Variables in Excel VBA

I don't completely understand your question. If you declare a Public (the
new term for "Global"), in a standard code module (not in a object module
like a Userform or Class module), you can write/read to and from that
variable from any procedure in any module in the project. E.g.,

Public MyVar As Variant

Beyond that, I don't understand what your dilemma is.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


wrote in message
ups.com...
I have an excel program, heavily driven by menus and buttons with
various entry-points and exits.

I am however attempting to create a global variable that could be used
to store and access data, regardless of the entry/exit point used.

Use of the public command would create a global variable which would to
this. However, given the fact that a user may come in at any point
(depending on what button or menu they use), there is no obvious way to
create a global variable.

Is there a way to actually create a global variable - that could be
used regardless of what a user presses?