Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the workbook I am currently working on I declare all my public variables
at the module level and set them in the Auto_Open macro, so that Module1 looks like this: Option Explicit Public PSPDI_WS As Worksheet Public PSPWO_WS As Worksheet Public etc, etc... __________________________________ Sub Auto_Open() Set PSPDI_WS = Workbooks("MyWorkbook.xls").Worksheets("MySheet1") Set PSPWO_WS = Workbooks("MyWorkbook.xls").Worksheets("MySheet2") Set etc, etc... End Sub So that all procedures can call those worksheets at any time. However, I find that after I have run a procedure and it ends, I can no longer use PSPDI_WS to reference my previously set worksheet object when I run another procedure (the same one again, or any other.) Why are my variables being reset, and how do I fix it? I thought a clue might be in the Static statement, but it appears that is only used at procedure level and it's effects are lost when the code stops executing. Thx -Mike-hime |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
trouble with excel | Excel Discussion (Misc queries) | |||
Trouble Graphing 1 point w/ 2 variables | Charts and Charting in Excel | |||
Excel trouble | Excel Discussion (Misc queries) | |||
trouble with excel | Excel Discussion (Misc queries) |