excel - 光标进入单元格时执行 Action

标签 excel vba

是否可以触发事件,当光标 进入 一个特定的细胞?

非常感谢

最佳答案

对的,这是可能的。请找到示例代码

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 2 And Target.Column = 2 Then
    MsgBox "hello"
End If

End Sub

因此,当您输入单元格 B2 时,您将获得 Hello msgbox。您可以替换您的操作而不是 MsgBox。

关于excel - 光标进入单元格时执行 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23473721/

相关文章:

c# - 通过 C# 刷新并保存 excel 文件

excel - 如何从 SharePoint 运行 Excel 宏?

arrays - VBA 嵌套 For 循环效率

excel - 使用 excel VBA 64 位(DSN Less 和 tnsnames)的 ODBC(非 OLEDB)的 Oracle 11g ado 连接字符串

c# - 如何在 C# 中将 System.Drawing.Color 转换为 ClosedXML.Excel.XLColor

html - 使用 VBA 动态创建 HTML 表格行

regex - 如何使用 Excel 公式来验证自定义的电子邮件地址?

sql access如何返回日期之间

Excel VBA : How to find max/min of a range while ignoring error cells

mysql - 如何通过检查Excel中的列使用vba从access中提取数据到excel