我无法找到一种方法来捕获特定工作表中特定数据透视表中的任何更改。
枢轴是“pivottable6” 工作表是“APAC”
我已将此代码放在 APAC 工作表模块中:
Private Sub Worksheet_PivotTableChange(ByVal Target As Excel.PivotTable6)
With Target
MsgBox "You performed an operation in the following PivotTable: " & .Name & " on " & Sh.Name
End With
End Sub
但我不断收到错误消息。关于如何解决它的任何想法?
Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Target, Target As PivotTable)
If Intersect(Target, ActiveSheet.PivotTables(1)) Is Nothing Then Exit Sub
MsgBox ("cat")
End If
End Sub
这仍然出现 USER TYPE NOT DEFINED ERROR