LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default I'm having some trouble with variables in Excel '97...

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
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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
trouble with excel EABCAM Excel Discussion (Misc queries) 1 August 28th 07 03:54 PM
Trouble Graphing 1 point w/ 2 variables Will Charts and Charting in Excel 2 January 8th 07 11:37 PM
Excel trouble Bob Leach Excel Discussion (Misc queries) 2 June 22nd 06 01:22 PM
trouble with excel CATHERINE Excel Discussion (Misc queries) 1 May 2nd 05 11:15 AM


All times are GMT +1. The time now is 08:17 AM.

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"