change event
Try following JE's suggestion once more.
And if you still have trouble, you may want to give a little more info.
enyaw wrote:
The debugger tells me that there is a compile error.
Range C38 is invalid outside procedure. in the ThisWorkbook module.
I would also like it to work for the range c38:c51.
"JE McGimpsey" wrote:
You'll need to use the Worksheet_Calculate event instead.
To detect a change in value, you'll need to save the value in a module
or static variable so you can compare the old value to the current value.
For instance:
In a regular code module:
Public vOldC38Value As Variant
In the ThisWorkbook module:
vOldC38Value = Sheets("Sheet1").Range("C38").Value
In the worksheet code module:
Private Sub Worksheet_Calculate()
With Range("C38")
If .Value < vOldC38Value Then
vOldC38Value = .Value
Macro2
End If
End With
End Sub
In article ,
enyaw wrote:
I have the following code that runs a macro when the cell value chages.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$38" Then
Call Macro2
End If
End Sub
The problem I have that cell C38 contains a formula and will not run the
macro because any change in value is not picked up. Can anyone help me?
--
Dave Peterson
|