coreyalaurence39
New Member
- Joined
- Mar 10, 2022
- Messages
- 20
- Office Version
- 2019
- Platform
- Windows
I am using the code below to tack changes to a cell in my worksheet. I need to this be done on multiple cells (ex. I2, L2, and P2) but I need to changes to be in three different sheets, so I2 would have it's own sheet, L2 it's own sheet and P2 it's own sheet. How would I do this in excel with the code below?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rw As Long
Dim strAddress As String
Dim strUserName As String
Dim dtmTime As Date
Dim v As Variant
If Intersect(Target, Range("I2")) Is Nothing Then Exit Sub
If Target.Address = Target.EntireRow.Address Then
Sheets("DispatcherTracking").Rows(Target.Row).Insert
If Application.CountA(Target) = 0 Then Exit Sub
End If
dtmTime = Now()
v = Target.Value
strAddress = Target.Address
strUserName = Environ("UserName")
Rw = Sheets("DispatcherTracking").Range("A" & Rows.Count).End(xlUp).Row + 1
With Sheets("DispatcherTracking")
.Cells(Rw, 1) = strUserName
.Cells(Rw, 2) = strAddress
.Cells(Rw, 3) = v
.Cells(Rw, 4) = dtmTime
End With
End Sub