mardi 5 janvier 2016

VBA code to create TimeStamp When updated

There are individual sheets which get updated that affect the "summary" sheet. In those sheets, there are checkboxes that need to be double clicked and then a timestamp when it was completed. I want to be able to adjust an individual's sheet, and it will show the checkbox and timestamp on the summary sheet.

I already have the sheet figured out to update the checkbox, but I can't seem to get the timestamp updated with what the individual sheets have. I have the code below of what I'm trying to do, let me know if you need any more information.

  • Analyst = the range of the checkboxes (column E)
    • The next column over, I want to put the timestamp (column F)
  • C, I think is moving down one by one

I want it to auto-update so not sure if there is anything I need to add or am forgetting.

Private Sub Analyst_Change(ByVal Target As Range)
Dim Analyst As Range, c As Range

    Set Analyst = Intersect(Application.ActiveSheet.Range("E:E"), Target)

    If Not Analyst Is Nothing Then
    Application.EnableEvents = False
    For Each c In Analyst
      Cells(c.Row, "F").Value = Now()

    Next c
   Application.EnableEvents = True
  End If

End Sub

Thanks!




Aucun commentaire:

Enregistrer un commentaire