Hi,
i hope that you guys can help...
I have macro that records changes made to a worksheet called: "Product BOM - 070".
Changes however are recorded to following worksheet:
"
Here is the code I hv:
Dim old_value As String
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="abcabc"
If Not Intersect(Target, Range("A7:R" & UsedRange.SpecialCells(xlCellTypeLastCell).row)) Is Nothing Then
Sheets("Revision Table - 070").Unprotect Password:="abcabc"
lr = Sheets("Revision Table - 070").Range("A" & Rows.Count).End(xlUp).row + 1
Sheets("Revision Table - 070").Cells(lr, 1).Value = Cells(Target.row, "a")
Sheets("Revision Table - 070").Cells(lr, 2).Value = Cells(Target.row, "b")
Sheets("Revision Table - 070").Cells(lr, 3).Value = Target.Address
Sheets("Revision Table - 070").Cells(lr, 4).Value = Cells(6, Target.Column).Value & ": " & old_value
Sheets("Revision Table - 070").Cells(lr, 5).Value = Target.Value
Sheets("Revision Table - 070").Cells(lr, 6).Value = Now
Sheets("Revision Table - 070").Cells(lr, 7).Value = Date
Sheets("Revision Table - 070").Cells(lr, 8).Value = Environ("Username")
Sheets("Revision Table - 070").Protect Password:="abcabc"
End If
ActiveSheet.Protect Password:="abcabc"
End Sub
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count < 2 Then
If Target.Value <> "" Then old_value = Target.Value
End If
End Sub
Any ideas? Will Greatly apprecite.
Coval
i hope that you guys can help...
I have macro that records changes made to a worksheet called: "Product BOM - 070".
Changes however are recorded to following worksheet:
Here is the code I hv:
Dim old_value As String
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="abcabc"
If Not Intersect(Target, Range("A7:R" & UsedRange.SpecialCells(xlCellTypeLastCell).row)) Is Nothing Then
Sheets("Revision Table - 070").Unprotect Password:="abcabc"
lr = Sheets("Revision Table - 070").Range("A" & Rows.Count).End(xlUp).row + 1
Sheets("Revision Table - 070").Cells(lr, 1).Value = Cells(Target.row, "a")
Sheets("Revision Table - 070").Cells(lr, 2).Value = Cells(Target.row, "b")
Sheets("Revision Table - 070").Cells(lr, 3).Value = Target.Address
Sheets("Revision Table - 070").Cells(lr, 4).Value = Cells(6, Target.Column).Value & ": " & old_value
Sheets("Revision Table - 070").Cells(lr, 5).Value = Target.Value
Sheets("Revision Table - 070").Cells(lr, 6).Value = Now
Sheets("Revision Table - 070").Cells(lr, 7).Value = Date
Sheets("Revision Table - 070").Cells(lr, 8).Value = Environ("Username")
Sheets("Revision Table - 070").Protect Password:="abcabc"
End If
ActiveSheet.Protect Password:="abcabc"
End Sub
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count < 2 Then
If Target.Value <> "" Then old_value = Target.Value
End If
End Sub
Any ideas? Will Greatly apprecite.
Coval