Hi, I found this tracking log on Ozgrid's site (is mentioned in the code), works for me, you will probably have to tailor it to your needs but is does also mention formula resuls.
Option Explicit
'* Link : http://www.ozgrid.com/VBA/track-changes.htm
'* Modified : 13-03-2018 by Hans Hallebeek (HC&TS)
'* Logs changes made in the entire workbook in a hidden worskheet named 'changeLogs'
'* Logs WORKSHEET,CELL CHANGED,OLD VALUE,NEW VALUE,TIME OF CHANGE,DATE OF CHANGE,USERNAME
'* To realy hide the worsksheet change .Visible = xlSheetHidden to .Visible = xlSheetVeryHidden
'* Password is coded in the VBa: 'Secret'
Dim vOldVal 'Must be at top of module
Dim logsWs As Worksheet 'Must be at top of module
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim bBold As Boolean
On Error GoTo makeLogSheet
Set logsWs = Worksheets("changeLogs")
Err.Clear
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
If IsEmpty(vOldVal) Then vOldVal = "Empty Cell"
bBold = Target.HasFormula
With logsWs
.Unprotect Password:="Secret"
If .Range("A1") = vbNullString Then
.Range("A1:G1") = Array("WORKSHEET", "CELL CHANGED", "OLD VALUE", _
"NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE", "USERNAME")
End If
With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
.Value = ActiveSheet.Name
.Offset(0, 1) = Target.Address
.Offset(0, 2) = vOldVal
With .Offset(0, 3)
If bBold = True Then
.ClearComments
.AddComment.Text Text:= _
"OzGrid.com:" & Chr(10) & "" & Chr(10) & _
"Bold values are the results of formulas"
End If
.Value = Target
.Font.Bold = bBold
End With
.Offset(0, 4) = Time
.Offset(0, 5) = Date
.Offset(0, 6) = Environ$("Username")
End With
.Cells.Columns.AutoFit
.Protect Password:="Secret", UserInterFaceOnly:=True
.Visible = xlSheetHidden
End With
vOldVal = vbNullString
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
On Error GoTo 0
Exit Sub
makeLogSheet:
ThisWorkbook.Worksheets.Add
ActiveSheet.Name = "changeLogs"
ActiveSheet.Visible = xlSheetHidden
Resume
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Count = 1 Then vOldVal = Target
End Sub
I suggest you visit that site for further information.
Bookmarks