Simple change event. Need guidance.

J

Jakester

I want to run a simple If..Then based on a change to a range of cell
containing text. Basically something like this

If Range("E50:E100") changes Then
Range("A3") = Now()
End if

So if the text changes in the range the date of the document updates t
the system date. Seems like it should be simple but I can't figure ou
how to do it. Any help appreciated.

Jakeste
 
F

Frank Kabel

Hi
put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
if target.cells.count>1 then exit sub
If Intersect(Range("E50:E100"), Target) Is Nothing Then Exit Sub
on error goto errhandler
With Target
If .Value <> "" Then
Application.EnableEvents = False
me.Range("A3").value=now
me.Range("A3").numberformat="MM/DD/YYYY hh:mm"
End If
End With

errhandler:
Application.EnableEvents = True
End Sub
 
P

pikus

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 _
And Target.Row >= 50 _
And Target.Row <= 100 Then
Range("A3") = Now()
End If
End Sub

= Piku
 
Top