View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Event recognition.


Hi

I use this code to look at cells in column D. If any has new content ,
then it puts the date in the adjacent cell in column C :


Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)

On Error GoTo enditall
Application.EnableEvents = False
If Intersect(Range(Target(1).Address), _
Range("D:D")) _
Is Nothing Then GoTo enditall
With Target
If .Value < "" Then
With .Offset(0, -1)

'Put in todays date :

.Value = Date

End With
Else: .Offset(0, -1).Value = ""
End If
End With
enditall:
Application.EnableEvents = True
End Sub


Unfortunately , it doesn't work when pasting content from other cells
into the cell in D. It only works when making direct typed entries. Can
someone suggest an amendment which would update after any entry (pasted
or directly entered) to the cell in D?



Best Wishes