Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a simple workbook with 1 sheet and a command button to run some code.
Under "Microsoft Excel Objects", Sheet1 I have this code: Public Y As String Public Sub CommandButton1_Click() X = "passed parameter" Y = "global variable" testmodule (X) End Sub Under "Modules", Module1 I have this code: Public Sub testmodule(X As String) MsgBox ("X is " + X) MsgBox ("Y is " + Y) End Sub When I press the command button I see two message boxes. The first says : "X is passed parameter" and the second says "Y is " Question is how can I get the Y variable seen in Module1 without passing it as a parameter? In other words have the message box say "Y is global variable". |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Global variable | Excel Discussion (Misc queries) | |||
Global Variable | Excel Discussion (Misc queries) | |||
Global Variable | Excel Programming | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
Global variable | Excel Programming |