Public Variables May Be Lost When You Copy a Worksheet (177834)
The information in this article applies to:
- Microsoft Excel 97 for Windows
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q177834 SYMPTOMS
In the versions of Microsoft Excel listed at the beginning of this article,
public variables may unexpectedly lose their values. As a result, when you
run a Microsoft Visual Basic for Applications procedure or macro that uses
the public variables, the procedure or macro may not run correctly or may
return incorrect results. (See the "More Information" section of this
article for a demonstration of this problem.)
CAUSE
This problem may occur when the following conditions are true:
RESOLUTION
To prevent this problem from occurring, follow these steps:
- In the Visual Basic Editor, click Options on the Tools menu.
- Click the Editor tab.
- Click to clear the Require Variable Declaration check box.
- Click OK.
After completing these steps, your public variables should retain their
values even when you copy a worksheet.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article.
REFERENCES
For additional information about getting help with Visual Basic for
Applications, please see the following article in the Microsoft Knowledge
Base:
163435 VBA: Programming Resources for Visual Basic for Applications
Modification Type: | Minor | Last Reviewed: | 10/10/2006 |
---|
Keywords: | kbbug kbdtacode kbProgramming KB177834 |
---|
|