Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global varible in Excel VBA? 1

Status
Not open for further replies.

timely2

MIS
Oct 11, 2005
17
US
The book I have does not show how to setup global variables and use between multiple forms that will close.

I have a string variable that is used to place information in the correct column. Based on a Select Case it will have the column based by date and shift. Example if:

date is today and shift is first it will make sCell = "ab"

This is then used to recognize that certain information goes into a cell in that column.

Later on that form closes and another opens to find out who attended. The information will be added under the same column in a given row as a comment.

What I do not know how to do is define the global variable and then make it so that I can use that global variable later in seperate class modules or userforms.

Do I put the global variable in a normal Modul or can I orginate it from the first form? How do I define it? How will I make it equal to something in a later form and still use that new value in other forms?

I know I need to get a book but this is the last part of a report I am building. Everything else is working.

Thank You,
Tim
 
Create a standard code module (menu Insert -> Module).
In the Declarations section:
Public sCell As String

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That was exactly what I was looking for. Thank You
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top