I am attempting to create a sheet that logs the changes made to an excel workbook. Is there a way to create a log of the link changes that are made? for example, the current document links to a June prices workbook, when a user changes this link to the July prices workbook i would like to run a macro that records that change in a log sheet.
Ideally, it will add a row to the log sheet containing the user who made a change, the cell address that was changed, the date and time of the change, as well as what the cell has been changed to. I have managed to make this work for manual changes made to cells by a user, but i haven't been able to extend this to track link changes or refreshes to sheets.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name = "Audit" Then
Exit Sub
Else
For Each c In Target
LR = Sheets("Audit").Cells(Rows.Count, "A").End(xlUp).Row + 1
ActiveWorkbook.Sheets("Audit").Cells(LR, 1).Value = Application.UserName
ActiveWorkbook.Sheets("Audit").Cells(LR, 2).Value = Sh.Name & "!" & c.Address
ActiveWorkbook.Sheets("Audit").Cells(LR, 3).Value = Now
ActiveWorkbook.Sheets("Audit").Cells(LR, 4).Value = c.Value
Next c
End If
End Sub
The above code does track any manually input changes, but I also need a way to add a row to the log sheet when a link is changed...