微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决在一张纸上进行多次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 举报,一经查实,本站将立刻删除。