Microsoft Office Tutorials and References
In Depth Information
xlCalculationAutomatic , the default value, which causes Excel to recalculate your
formulas every time a change is made.
xlCalculationManual , which requires a user to press Shift+F9 to recalculate the
formulas in the active worksheet.
xlCalculationSemiautomatic , which recalculates all formulas in a worksheet, except for
those formulas in a table.
If you only want to calculate formulas just before you save a workbook, you can set
recalculation to manual and then set the Application object’s CalculateBeforeSave property to Tr ue ,
as in the following code:
Application.Calculation = xlCalculationManual
Application.CalculateBeforeSave = True
The first line of defense against changes to a worksheet starts with requiring users to enter a
password before they are allowed to open the workbook. The Workbook object’s Protect
method is somewhat limited, allowing you to protect against unauthorized access to the
workbook, to protect against changes to the workbook’s structure, or to protect against
changes to the size and placement of the workbook’s windows. There’s quite a bit more going
on at the worksheet level, however, and the Sheet and Wo rksheet objects’ Protect methods
have correspondingly more options available.
expression.Protect( Password , DrawingObjects , Contents , Scenarios ,
UserInterfaceOnly , AllowFormattingCells , AllowFormattingColumns ,
AllowFormattingRows , AllowInsertingColumns , AllowInsertingRows ,
AllowInsertingHyperlinks , AllowDeletingColumns , AllowDeletingRows ,
AllowSorting , AllowFiltering , AllowUsingPivotTables )
Table 7-7 provides the default values for each of these parameters and describes what is or is
not allowed when the options are set to Tr ue or False .
Table 7-7. Parameters of the Worksheet.Protect Method
A required expression that returns a Worksheet
A string that specifies a case-sensitive password
for the worksheet or workbook. If this argument is
omitted, you can unprotect the worksheet or
workbook without using a password.
When set to True , this parameter protects drawing
objects from changes.