具有下拉值的Target.Address

我注意到,当目标地址是一个下拉菜单(数据validation – 从表中拉出)时,我无法使用worksheet_change函数。 有没有办法做到这一点成功?

示例(不起作用):

sub Worksheet_Change(ByVal Target as Range) If Target.Address="$G$8" then sheet4.conditions End if End sub 

谢谢!

我相信你的代码在错误的工作表中,或者下拉列表与你的代码不同。 尝试将其放在Sheet1中,并更改Sheet1上的“G8”以查看会发生什么情况

 sub Worksheet_Change(ByVal Target as Range) If Target.Address="$G$8" then MsgBox "It works!" End if End sub 

我知道代码的作品。 如果这样做,然后尝试你的代码,如果它不起作用,那么我相信你的sheet4.conditions有问题