ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Log specific changes (https://www.excelbanter.com/excel-programming/418329-log-specific-changes.html)

Sam

Log specific changes
 
I have code in a workbook_BeforeSave event that Appends a txt file with an
entry that stamps user & date/time when the file is saved. I would like to
log any specific cells that are changed. The workbook has many worksheets and
I can conditionally choose the time period that I want to track the changes.
If cell $C$5 on sheet3 is changed, I want to log this and any other sheets
that are changed.

Thanks,

Sam

Andym

Log specific changes
 
This code should give you a start. The allChanges variable will keep track
of each change made in the workbook. You may need to add additional code to
track the sheet the change was made on. This code should be put into the
ThisWorkbook module.

Public allChanges As String
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
allChanges = allChanges & "Cell(" & Target.row & "," & Target.Column & _
") changed to '" & Target.Value & "'" & vbCrLf
End Sub

"Sam" wrote:

I have code in a workbook_BeforeSave event that Appends a txt file with an
entry that stamps user & date/time when the file is saved. I would like to
log any specific cells that are changed. The workbook has many worksheets and
I can conditionally choose the time period that I want to track the changes.
If cell $C$5 on sheet3 is changed, I want to log this and any other sheets
that are changed.

Thanks,

Sam



All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com