在一张纸上进行多次SelectionChange检查

问题描述

试图为多个像元值创建SelectionChange。我获得了以下代码来进行单选更改:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)


'This line stops the worksheet updating on every change,it only updates when cell H6 or H7 is touched
If Intersect(Target,Range("O1")) Is nothing Then Exit Sub
 
'Set the Variables to be used
Dim pt As Pivottable
Dim Field As PivotField
Dim NewCat As String
 
'Here you amend to suit your data
Set pt = Worksheets("Pivot Tables").Pivottables("Pivottable3")
Set Field = pt.PivotFields("OH Bucket")
NewCat = Worksheets("Pivot Tables").Range("O1").Value
 
'This updates and refreshes the PIVOT table
With pt
Field.ClearallFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
 
End Sub

但是我还需要检查Range(“ C1”)是否更改,更新Pivottable1

任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)