coreyalaurence39
New Member
- Joined
- Mar 10, 2022
- Messages
- 20
- Office Version
- 2019
- Platform
- Windows
VBA Code:
Option Explicit
Public OldData
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("A5:P1000,I2,L2,P2")) Is Nothing Then OldData = Target.Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("A5:P1000")) Is Nothing Then
Application.ScreenUpdating = False
Sheets("Log Details").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 5).Value = Array(Environ("UserName"), Target.Address, OldData, Target.Value, Now())
Else
If Intersect(Target, Range("I2,L2,P2")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Select Case Target.Column
Case Is = 9
Sheets("DispatcherTracking").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 5).Value = Array(Environ("UserName"), Target.Address, OldData, Target.Value, Now())
Case Is = 12
Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 5).Value = Array(Environ("UserName"), Target.Address, OldData, Target.Value, Now())
Case Is = 16
Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 5).Value = Array(Environ("UserName"), Target.Address, OldData, Target.Value, Now())
End Select
End If
Application.ScreenUpdating = True
End Sub
I would like to add the function of tracking when a formula is changed in the sheet to the above code. I would like to know what the old formula was and what it has been changed too. I am not sure how to add this functionality to the above code.