1.

How Do I Run A Macro Every Time A Certain Cell Changes Its Value?

Answer»

There is an event called Worksheet CHANGE which is triggered when a value is entered (it will not fire when a formula result changes). One of the arguments to this event is 'Target' which is a reference to what CHANGED.

Since this event will occur whenever a value changes -

you can USE the target to see if it is the cell you are interested in:

Private Sub Worksheet Change (ByVal Target as Range)

If Intersect (Target, Range ("C5")) Is Nothing Then

Exit Sub

Else

'The cell you are monitoring has changed!

'Do whatever you NEED to do...

End If

End Sub

There is an event called Worksheet Change which is triggered when a value is entered (it will not fire when a formula result changes). One of the arguments to this event is 'Target' which is a reference to what changed.

Since this event will occur whenever a value changes -

you can use the target to see if it is the cell you are interested in:

Private Sub Worksheet Change (ByVal Target as Range)

If Intersect (Target, Range ("C5")) Is Nothing Then

Exit Sub

Else

'The cell you are monitoring has changed!

'Do whatever you need to do...

End If

End Sub



Discussion

No Comment Found