MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Help With - Private Sub Worksheet_Change(ByVal Target As Excel.Range)


Posted by Stone on December 16, 2001 12:52 PM

I need some help with the following code. The code below executes the macro SendEMail just fine when I manually change the value of cell C5 and hit enter. However, C5 is being updated every 30 minutes by a Web Query. When the refresh takes place and the value of C5 is < 30, the code does not execute.

I want the code to run the macro SendEMail, when the value of C5 is < 30, based on the Web Query refresh.

Thanks for your assistance in advance.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$C$5" Then
If Target.Value < 30 Then
' my code runs a macro named SendEMail
SendEMail
End If
End If
End Sub


Posted by Jim on December 16, 2001 1:05 PM

Hi Stone,

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Range("C5").Select
If ("C5")< 30 Then
'Your code.........
End If
End Sub

I'm guessing

Jim