Tracking changes

TG2812

Board Regular
Joined
Apr 15, 2015
Messages
192
Hi,

I'm trying to track changes from the the sheet "Main" and document/track these changes back in sheet "Tracking".
However when I make some changes in sheet main, nothing happens in the sheet tracking. Any idea why?

The code I'm using is the following:


Dim oldAddress As String
Dim oldValue As String
-----------------------------------------------------------------

Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal Target As Range)

Dim sh As String
sh.name = "Main"

If WS.name <> Tracking Then
Application.EnableEvents = False


Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Range("A" & Target.Row)
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 1).Value = Range("B" & Target.Row)
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 2).Value = Range("C" & Target.Row)
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 3).Value = Range("D" & Target.Row)
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 4).Value = oldValue
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 5).Value = Target.Value
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 6).Value = Environ("username")
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 7).Value = Now
Sheets("Tracking").Hyperlinks.Add anchor:=Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(0, 8), Address:="", SubAddress:="'" & WS.name & "'!" & oldAddress, TextToDisplay:=oldAddress
End If
Application.EnableEvents = True


End Sub

---------------------------------------------------------

Private Sub Workbook_SheetSelectionChange(ByVal sh As Object, ByVal Target As Range)
On Error GoTo Err
oldValue = Target.Value
oldAddress = Target.Address

Err:
End Sub
 
.
Your request has now changed to a different topic of discussion for assistance. FORUM rules stipulate you need to post this new request into a separate request for assistance.
That assists others who, in the future, review the many posts and can identify which topics most accurately match the assistance they are seeking.

Please post a new thread with your last question.

Thanks.
 
Last edited by a moderator:
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Logit. Apologies for this. I was ignorant of that rule.
Thanks anyway for your great support.
 
Upvote 0
You are welcome !

Merry Christmas.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top