Triggering worksheets events with changes in pivots

Woodlander

Board Regular
Joined
Aug 31, 2011
Messages
52
A change in a pivot cell (here: B1) does not work with the code below. Any ideas?
Private Sub Worksheet_Change(ByVal Target as Range)
If Target.Address = "$B$1" Then
MsgBox "Re-populate tables and print"
End If
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Example:

Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    If Target.Name = "PivotTable1" Then
        MsgBox "PivotTable1 changed"
    End If
End Sub
 
Upvote 0
In what way didn't it work? Where did you put the code? What's the name of your pivot table? What's actually in B1?
 
Upvote 0
It did not work in any possible way.

Code is in the Sheet1 workbook; B1 is a cell at the top of the pivot table, that is used as a filter.

The pivot table's name is PivotTable1.

Thanks.
 
Upvote 0
B1 is part of my pivot table, and as a matter of fact, it is in the report filter section. I am sorry, but I don't see in your code any reference to any cell at all. Or is it that I have to embed your code into mine? Thanks again.
 
Upvote 0
The code should work with a report filter, but I can't test it at the moment because I only have Excel 2003. I mentioned B1 because that was the cell you were testing in your original code.

Does the Worksheet_Calculate event fire when you select from the report filter?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top