SiRhOSEven
New Member
- Joined
- Jan 21, 2018
- Messages
- 9
Hello, I have a worksheet that track changes and logs into a sheet when cell changes. It logs the Sheet Name where the change happen.
However, I have multiple data that needs to change in a single sheet. The problem is that it only logs the sheet name and not the column where I change the cell.
With this, I want to track changes in a certain column and returns a "text" where the changes happens instead of the sheet name. Below is the code that I got from searching google:
Here is the link for the sample file for you to check => https://drive.google.com/file/d/1pxi9Ulr9Gb-5vrKgv8oYjOIRzKE0qhfW/view?usp=sharing
Thank you to all.
However, I have multiple data that needs to change in a single sheet. The problem is that it only logs the sheet name and not the column where I change the cell.
With this, I want to track changes in a certain column and returns a "text" where the changes happens instead of the sheet name. Below is the code that I got from searching google:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)If ActiveSheet.Name <> "LOGS" Then
Application.EnableEvents = False
Dim OldValue As String, NewValue As String
NewValue = Target.Value
Application.Undo
OldValue = Target.Value
Target.Value = NewValue
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = ActiveSheet.Name
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(0, 1).Value = OldValue
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(0, 2).Value = NewValue
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(0, 3).Value = Date
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(0, 4).Value = Time
Sheets("LOGS").Range("B" & Rows.Count).End(xlUp).Offset(0, 5).Value = Date
Application.EnableEvents = True
End If
End Sub
Here is the link for the sample file for you to check => https://drive.google.com/file/d/1pxi9Ulr9Gb-5vrKgv8oYjOIRzKE0qhfW/view?usp=sharing
Thank you to all.