3

I got a pivot table with shows the data for Quarters in it, and a macro that performs some calculations based on the data in pivot table. So now I want to run the Macro automatically when I changed the selection of pivot items, like if select Quarter1 , it shows the values for Q1 and run the macro automatically so that it calculate the values for Q1, and same for all selections including the multiple selections..

4

1 回答 1

10

在带有数据透视表的工作表的代码模块中放入类似这样的内容:

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

' Call your macro here

End Sub
于 2012-05-29T13:37:55.483 回答