根据列表中的更改触发宏 [英] Trigger a macro based on a change on a list

查看:65
本文介绍了根据列表中的更改触发宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......我正在尝试执行宏来仅在列表中的值更改时更新数据透视表。我正在使用

Hi...I'm trying to execute a macro to update a pivot only when a value in a list changes. I'm using

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

和Intersect函数,但我无法制作它工作,因为当我点击包含该列表的单元格时,数据透视刷新,然后如果我更改其值,则没有任何反应。列表在单元格C5上,我需要宏只在我将
更改为该列表中的某个值时执行。

and the Intersect function, but I can't make it work as in the moment I click on the cell that contains the list the pivot refreshes and then if I change its value, nothing happens. The list is on the cell C5 and I need the macro only executes when I change some value in that list.

任何帮助都将受到赞赏

谢谢,

Ezequiel

推荐答案

如果您想对价值变化做出反应,您应该使用Worksheet_Change事件而不是Worksheet_SelectionChange事件。
If you want to react to a change in value, you should use the Worksheet_Change event instead of the Worksheet_SelectionChange event.


这篇关于根据列表中的更改触发宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆