Article ID: 213581 - Last Review: March 21, 2007 - Revision: 4.1 VBA code "behind" a worksheet or a workbook may not work in ExcelThis article was previously published under Q213581 For a Microsoft Excel 97 version of this article, see 157346
(http://support.microsoft.com/kb/157346/EN-US/
)
.
For a Microsoft Excel 98 version of this article, see 182482 (http://support.microsoft.com/kb/182482/EN-US/ ) . SYMPTOMS
In Microsoft Office Excel, Microsoft Visual Basic for Application (VBA) macro code that is contained "behind" a worksheet or
workbook may not work correctly.
CAUSE
This will occur if both of the following conditions are true:
WORKAROUND
In order for automatically-running subroutines to work correctly in
Microsoft Excel, they must be contained within a Visual Basic module. You must insert a Visual Basic module into the workbook and then place the code in the new module. To insert a Visual Basic module:
MORE INFORMATION
In Excel, VBA code can be stored in three different locations: in a Visual Basic module, in a Visual Basic
class module, and "behind" worksheets and workbooks. To edit code "behind" a worksheet or a workbook:
VBAProject (Book1)
Microsoft Excel Objects
Sheet1 (Sheet1)
Sheet2 (Sheet2)
Sheet3 (Sheet3)
ThisWorkbook
Modules
Module1
If an Auto_Open, Auto_Close, or other automatically-running subroutine is stored "behind" a worksheet or ThisWorkbook, it may not function correctly when you open or close your workbook, or when you perform an action that should cause the subroutine to run. | Article Translations
|
Back to the top
