View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Worksheet_Change

You need to use the Address property to determine what cell was
change. E.g.,

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Application.EnableEvents = False
Range("A2").Value = Now
Application.EnableEvents = True
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ram" wrote in message
...
I have been trying to use the following code but for some reason
Nothing is
happening when I make a change to cell ("A1"). I pasted the
code in a module,
and clicked on the sheet1 and right clicked the mouse to view
the code and
pasted it in. Can someone tell me what i'm doing wrong.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target = Cells(1, 1) Then Cells(2, 1) = Now
End Sub 'alternatives: NOW() or date or Time

Thanks for any help