Microsoft Office Tutorials and References
In Depth Information
Worksheet_PivotTableUpdate Event
Worksheet_pivotTableupdate Event
The Worksheet_PivotTableUpdate event occurs after a pivot table is updated on a worksheet, such
as after a refresh. The following procedure is a simple example of the syntax for this event:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
MsgBox “The pivot table on this worksheet was just updated.”, vbInformation, “FYI”
End Sub
Try iT
In this lesson, you write a Worksheet_Change event that allows you to sum numbers as they are
entered into the same cell. You write a Worksheet_Change event for your worksheet, where any
cell in column A except for cell A1 will accept a number you enter, add it to whatever number was
already in that cell, and display the resulting sum. For example, if cell A9 currently holds the
number 2 and you enter the number 3 in that cell, the resulting value of cell A9 will be 5.
lesson requirements
To get the sample database files you can download Lesson 11 from the book’s website at .
Open a new workbook, right-click the Sheet1 tab, and select View Code.
Your cursor will be blinking in the Sheet1 worksheet module. Directly above that, click the
down arrow belonging to the Object list, and select Worksheet. This will produce the
following default lines of code in your worksheet module:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
It is really the Change event you are interested in composing, so take one of two actions:
either manually edit the Private Sub Worksheet_SelectionChange(ByVal Target
As Range) statement by deleting the word Selection , or click the down arrow above the
module for the Procedures list, select the Change item, and delete the default Private Sub
Worksheet_SelectionChange(ByVal Target As Range) statement and its accompanying
End Sub statement. At this point, the only procedure code you will see in your worksheet
module is this:
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
Search JabSto ::

Custom Search