View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Karen Mckenzie Karen Mckenzie is offline
external usenet poster
 
Posts: 1
Default Worksheet Change Event - track changes


Really helpful, thanks!!



Jacob Skaria;582812 Wrote:
Hi Karen

Try the below which makes use of Worksheet Change and Selection events
to
track real changes made to the worksheet. Select the sheet tab which
you want
to work with. Right click the sheet tab and click on 'View Code'. This
will
launch VBE. Paste the below code to the right blank portion. Get back
to to
workbook and try out.


Dim varData As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A2:N5000")) Is Nothing
Then
If Target.Count = 1 And Target.Value < varData Then
Application.EnableEvents = False
Range("P" & Target.Row) = Now()
Application.EnableEvents = True
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
varData = Target.Value
End Sub

--
Jacob


"karen" wrote:

I'm looking for an easy way to track changes in a large spreadsheet
Could someone help me with code to add a date into column P if any

changes
are made in the row. The range that this needs to apply to are is

A2:N5000

I know this is a worksheet change event but don't understand the

mechanics
of writing the code to do what I want



--
Karen Mckenzie
------------------------------------------------------------------------
Karen Mckenzie's Profile: 1287
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=161285

Microsoft Office Help