ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to declare global variable in Excel VBA? (https://www.excelbanter.com/excel-programming/397972-how-declare-global-variable-excel-vba.html)

Sing

How to declare global variable in Excel VBA?
 
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.



Jim Cone

How to declare global variable in Excel VBA?
 

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.




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

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