我是VBA的新手,我的脚本不断重复,我不确定原因。有人可以帮助我吗? 当任何值J3:K4大于10时,我只想运行脚本'mail_small_text_outlook'。每30分钟自动重新计算一次J3:K4。
先谢谢了。
Private Sub Worksheet_Calculate()
Dim target As Range
Set target = Range("J3:K4")
If target Is Nothing Then Exit Sub
If IsNumeric(target) And target > 10 Then
Call Mail_small_Text_Outlook
End If
End Sub
答案 0 :(得分:0)
您必须遍历范围内的单元格
Sub Worksheet_Calculate()
Dim target As Range
Set target = Range("J3:K4")
Dim cel As Range
For Each cel In target.Cells
If IsNumeric(cell) And cell > 10 Then
Call Mail_small_Text_Outlook
End If
Next cel
End Sub