Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Declaring Global Variables

Howdy all.
I have a workbook with around 7 modules.
Each module refer's to a few cells in one worksheet, to
create a few variables. I want to be able to declare those
variables as global, so i dont have to have the same
variable declaring coding in each module.

Can this be done by simply making another module and
putting the declarations in as Public, instead of Dim?
(Note: i need to keep macro'sin seperate modules for
cleanlyness...)

Any assitance is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Declaring Global Variables

If the modules are public and you variables are declared at the top of the
module outside any procedure then a variable like

Public lVar as Long

should be visible to all other modules in the project.

Regards,
Tom Ogilvy

skmr3 wrote in message
...
Howdy all.
I have a workbook with around 7 modules.
Each module refer's to a few cells in one worksheet, to
create a few variables. I want to be able to declare those
variables as global, so i dont have to have the same
variable declaring coding in each module.

Can this be done by simply making another module and
putting the declarations in as Public, instead of Dim?
(Note: i need to keep macro'sin seperate modules for
cleanlyness...)

Any assitance is greatly appreciated.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring variables for use in multiple worksheets tompl Excel Discussion (Misc queries) 0 April 8th 10 04:40 PM
Overflow error when declaring variables Jeff Excel Discussion (Misc queries) 2 January 9th 08 04:15 PM
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 09:27 PM
Declaring variables freekrill Excel Discussion (Misc queries) 2 July 19th 06 06:36 AM
Declaring variables freekrill Excel Discussion (Misc queries) 0 July 18th 06 06:15 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"