Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Read Variable from Another Module

That was very helpful. I greatly appreciate the help!

"Jim Thomlinson" wrote:

When refering to variables in other module you just need (or at the very
least should) reference the module and then the variable name to get the
value something like this...

Private Sub Worksheet_calculate()
msgbox Module1.TheWb 'Or whatever the module name is
end sub

Additionally in the module where you declare the variable my preference is
to use the public key word so that I know that the variable is being accessed
from a procedure outside the module

Option Base 1
Public TheWb as String 'Note public instead of just dim

While this is not strictly necessary I like it as a reminder...
--
HTH...

Jim Thomlinson


"Mike H." wrote:

I have a sub: Private Sub Worksheet_calculate(). How can I read a variable
from a module that was set at the top of that module:

Option Base 1
Dim TheWb As String

I want to know what the value of TheWb is while in the calculate sub...


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
STATIC VARIABLE NOT AVAILABLE IN ANOTHER MODULE CAPTGNVR Excel Discussion (Misc queries) 2 February 1st 07 07:30 PM
How to Set a Variable in Another Module? Steve Drenker[_4_] Excel Programming 1 March 17th 06 06:28 PM
Variable in more than one module Nick M[_3_] Excel Programming 2 November 8th 05 07:20 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
Pass a variable from a class module pk Excel Programming 1 October 2nd 03 08:24 PM


All times are GMT +1. The time now is 11:28 PM.

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

About Us

"It's about Microsoft Excel"