每当更新 Excel 电子表格中的单元格时,如何自动运行宏?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A1" And Target.Value > 0 Then
MsgBox ("A1 has changed.")
Application.Run("A1Changed")
End If
End Sub
但这只是在价值变为正数时。当对 A1 进行任何更改时,如何让这个宏开始执行?此外,使用 Private Sub 是否意味着这将不断监视我的电子表格的更新?
我的问题是在更新或更改单元格时将数据从 excel 导出到 SQL Server。