• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

adding a trigger on cell change

dasarathreddy

New Member
This is the first time I am trying to use Excel triggers and have no clue hoe to so please spoon feed.


I have a cell with 5 possible values.

What I want to do is record the date when this cell was changed. depending on the selected value the date is recorded in a certain different cell


That's it !!

Thanks for your help...
 
Hi Reddy ,


Can you try the following and see if it helps ?


Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("K3")) Then

Application.EnableEvents = False

Range("L15").Value = Now()

Application.EnableEvents = True

End If

End Sub


Here , the data entry is in cell K3 , through a validation list of 5 items.


Whenever the data in K3 is changed , the current time is entered into cell L15.


Narayan
 
Thanks a lot Narayan.. That worked perfectly...

One More question...


I want change in K3 to enter the date into L3

and change in K4 to enter the date into L4

and change in K5 to enter the date into L5


and so on....

Thanks for your help
 
Hi Reddy ,


Try the following :


Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("K3:K100")) Then

Application.EnableEvents = False

offset_row = Target.Row - 3

Range("L3").Offset(offset_row).Value = Now()

Application.EnableEvents = True

End If

End Sub


I have assumed that your data range will be from K3 through K100. Change this to whatever is the required range.


Narayan
 
Back
Top