我们可以通过单击具有公式的单元格来 运行 vba 子吗?
Can we run vba sub by clicking a cell which has a formula?
是否可以通过单击其中包含公式的单元格来 运行 VBA 子。
我知道可以在没有确定其值的公式的单元格上 运行。
怎么办?
请分享您的想法。
提前致谢。
只需使用选择更改事件并测试 .HasFormula
属性:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count = 1 And Target.HasFormula Then
'// your code here
End If
End Sub
是否可以通过单击其中包含公式的单元格来 运行 VBA 子。
我知道可以在没有确定其值的公式的单元格上 运行。
怎么办?
请分享您的想法。
提前致谢。
只需使用选择更改事件并测试 .HasFormula
属性:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count = 1 And Target.HasFormula Then
'// your code here
End If
End Sub