Tracking my employee's history of changes.

ZEUSZEUS

New Member
Joined
Apr 1, 2009
Messages
35
Have a dilemma.
I am using excel as point of sale book (to record customer name, service, and total price etc.) at our hair salon. We have employees that may be there to manage alone from time to time, and enter clients into excel.
Our worry is straight forward, and involves them erasing what they wrote. I am confident that the actual service and price is entered at the beginning, but want to track their changes to their own entries.

The "track changes" would work if it "tracked changes" after entry. But it seems to track the last change from saving. For example....the employee enters $40.25 presses enter--after she knows she can get away with a change, she may erase it altogether or change it to say $16.75.

Please help.
Thanks in advance
 
This just writes Saved in column G whenever the file is saved (manually or automatically).
 
Upvote 0
What a noob I am----I should be able to read some code by now!

So I guess making the file save when a certain column's cell is entered is not an easy fix?:confused:

Tom.
 
Upvote 0
Try this

Rich (BB code):
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim LR As Long, X As Variant
If Sh.Name = "Log" Then Exit Sub
X = Target.Value
With Application
    .EnableEvents = False
    .ScreenUpdating = False
    If Target.Count = 1 Then .Undo
End With
With Sheets("Log")
    .Unprotect Password:="pw"
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("A" & LR + 1).Value = Now
    .Range("B" & LR + 1).Value = Sh.Name
    .Range("C" & LR + 1).NumberFormat = "@"
    .Range("C" & LR + 1).Value = Target.Address(False, False)
    .Range("D" & LR + 1).Value = Target.Value
    .Range("E" & LR + 1).Value = X
    .Range("F" & LR + 1).Value = Environ("username")
    .Protect Password:="pw"
End With
If Target.Count = 1 Then Target.Value = X
On Error Resume Next
Target.Offset(, 1).Select
On Error GoTo 0
With Application
    .EnableEvents = True
    .ScreenUpdating = True
End With
If Target.Column = 16 Then ThisWorkbook.Save
End Sub
 
Upvote 0
I have a hitch, how can i say if x = formula then to not log. So here is the problem I have many tables. When a new person is entered the Table automatically generates the formulas need, the logger will overwrite the formulas and place values. So i need the logger to ignore all formulas. Any Ideas. Also is there a way to say if a certain user opens the database not to run the logger at all. I have been playing with if Enviorn (User) = "anissen" then Exit Sub.


Thanks
Alecia
 
Upvote 0
Try this

Rich (BB code):
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim LR As Long, X As Variant
If Environ("username") = "anissen" Then Exit Sub
If Sh.Name = "Log" Then Exit Sub
If Target.HasFormula Then Exit Sub
X = Target.Value
With Application
    .EnableEvents = False
    .ScreenUpdating = False
    If Target.Count = 1 Then .Undo
End With
With Sheets("Log")
    .Unprotect Password:="pw"
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("A" & LR + 1).Value = Now
    .Range("B" & LR + 1).Value = Sh.Name
    .Range("C" & LR + 1).NumberFormat = "@"
    .Range("C" & LR + 1).Value = Target.Address(False, False)
    .Range("D" & LR + 1).Value = Target.Value
    .Range("E" & LR + 1).Value = X
    .Range("F" & LR + 1).Value = Environ("username")
    .Protect Password:="pw"
End With
If Target.Count = 1 Then Target.Value = X
On Error Resume Next
Target.Offset(, 1).Select
On Error GoTo 0
With Application
    .EnableEvents = True
    .ScreenUpdating = True
End With
If Target.Column = 16 Then ThisWorkbook.Save
End Sub
 
Upvote 0
A change in Plans. My Database has grown much and do not neet to track changes on all sheets, but if I add if Sheet Name is such and such the exit sub (there are many) it takes way to long tooooo run. So I just added the macro to the individual sheet code and it works great except it does not record the previous value. Again any assistance will be appreciated.

Thanks
Alecia

Private Sub Worksheet_Change(ByVal Target As Range)
Dim LR As Long, x As Variant
If Environ("username") = "aarcher" Then Exit Sub
If Environ("username") = "Executive Director" Then Exit Sub
If Target.HasFormula Then Exit Sub
x = Target.Value
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
On Error Resume Next

.Undo

End With
With Sheets("Log")
.Unprotect Password:="myfadra"
LR = .Range("A" & Rows.Count).End(xlUp).row
.Range("A" & LR + 1).Value = Now
.Range("B" & LR + 1).Value = "PP"
.Range("C" & LR + 1).NumberFormat = "@"
.Range("C" & LR + 1).Value = Target.Address(False, False)
.Range("D" & LR + 1).Value = Target.Value
.Range("E" & LR + 1).Value = x
.Range("F" & LR + 1).Value = Environ("username")
.Protect Password:="myfadra"
End With
Target.Value = x
Target.Offset(, 0).Select
With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
 
Upvote 0
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LR As Long, x As Variant
If Environ("username") = "aarcher" Then Exit Sub
If Environ("username") = "Executive Director" Then Exit Sub
If Target.HasFormula Then Exit Sub
x = Target.Value
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
On Error Resume Next

.Undo
y = Target.Value 'here is the previous value
End With
With Sheets("Log")
.Unprotect Password:="myfadra"
LR = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A" & LR + 1).Value = Now
.Range("B" & LR + 1).Value = "PP"
.Range("C" & LR + 1).NumberFormat = "@"
.Range("C" & LR + 1).Value = Target.Address(False, False)
.Range("D" & LR + 1).Value = Target.Value
.Range("E" & LR + 1).Value = x
.Range("F" & LR + 1).Value = Environ("username")
.Protect Password:="myfadra"
End With
Target.Value = x
Target.Offset(, 0).Select
With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
'Just so you can test it, this can be removed
MsgBox x 
MsgBox y


End Sub
 
Upvote 0

Forum statistics

Threads
1,226,832
Messages
6,193,211
Members
453,780
Latest member
Nguyentam2007

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