Microsoft provides programming examples for illustration only,
without warranty either expressed or implied. This includes, but is not limited
to, the implied warranties of merchantability or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language that is being demonstrated and with the tools that are used to create
and to debug procedures. Microsoft support engineers can help explain the
functionality of a particular procedure, but they will not modify these
examples to provide added functionality or construct procedures to meet your
specific requirements.
To work around this problem, use the
UsedRange property when you calculate formulas. To do this, use one of the
following methods depending on how you calculate formulas.
You use the Calculate method in a VBA macro to calculate formulas
If you use the
Calculate method in a VBA macro to calculate the formulas in a workbook,
use the
UsedRange property.
For example, you use one of the following
Calculate methods:
- ActiveSheet.Calculate
- Worksheets("Sheet1").Calculate
Instead, use the
UsedRange property as follows:
- ActiveSheet.UsedRange.Calculate
- Worksheets("Sheet1").UsedRange.Calculate
You press SHIFT+F9 to manually calculate formulas
If you press SHIFT+F9 to manually calculate formulas in the
active worksheet, create a Microsoft Visual Basic for Applications (VBA) macro
to capture the keystrokes and to programmatically use the
UsedRange property.
To do this, follow these steps:
- Open a new workbook in Excel.
- On the Tools menu, point to
Macro and then click Visual Basic Editor. Or,
press ALT+F11 to open the Visual Basic Editor.
- In the Project window, double-click
ThisWorkbook.
- Paste or type the following VBA code in the module code
sheet:
Private Sub Workbook_Open()
Application.OnKey key:="+{F9}", procedure:="Calcit"
End Sub
Sub Calcit()
ActiveSheet.UsedRange.Calculate
End Sub
- Press ALT+TAB to switch back to the worksheet.
- On the File menu, click
Properties.
- On the Summary tab, type the title of the
add-in that you want to appear in the Add-Ins dialog box, and
then click OK.
- On the File menu, click Save
As.
- In the Save as type box of the
Save As dialog box, click Microsoft Office Excel
Add-in (*.xla), type a name for the add-in in the File
name box, and then click Save.
Note Save the add-in in the following folder: C:\Program Files\Microsoft Office\Office11\Library
- To load the new add-in, follow these steps:
- On the Tools menu, click
Add-Ins.
- Click to select the check box for the new add-in, and
then click OK to close the Add-Ins dialog
box.