How to declare global variable in Excel VBA?

S

Sing

Dear Excel Gurus,

This may sound like a basic question, but I only know C and am new to Excel
VBA

I wish to define a global variable that is accessible to all worksheets. Can
someone advise?

Thanks.
 
J

Jim Cone

In a standard/regular module - not a Class module - at the top of the module...

Public Const LNG_LENGTH As Long = 123
-or-
Public lngLength as Long
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Sing"
wrote in message
Dear Excel Gurus,
This may sound like a basic question, but I only know C and am new to Excel
VBA
I wish to define a global variable that is accessible to all worksheets. Can
someone advise?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top