I'm new to VBA and my script keeps repeating, I'm unsure as to why. Is anyone able to help me with this? I just want to run the script 'mail_small_text_outlook' when any of the values J3:K4 are calculated to be greater than 10. J3:K4 are recalculated automatically every 30 minutes.
Thanks in advance.
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
You must iterate over the cells in the range
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.