Hello all,
First time posting, I'm having trouble with a simple VBA sub I've been working on. The idea is that the code drops a timestamp into a specific cell when the Plan-Do-Check-Accept (PDCA) status of that row changes.
The code was running smoothly, however recent usage has been giving a Run-time error 13. I've worked the mismatch error is occuring between v (string) & Target.Value (variant), but I'm wondering what the easiest way is to fix this mismatch?
Thanks for your time!
Ben
First time posting, I'm having trouble with a simple VBA sub I've been working on. The idea is that the code drops a timestamp into a specific cell when the Plan-Do-Check-Accept (PDCA) status of that row changes.
Code:
Sub Worksheet_Change(ByVal Target As Range)
Dim D As Range: Set D = Range("D:D")
Dim v As String
If Intersect(Target, D) Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
v = Target.Value
If v = "P" Then Target.Offset(0, 1) = Now()
If v = "D" Then Target.Offset(0, 2) = Now()
If v = "C" Then Target.Offset(0, 3) = Now()
If v = "A" Then Target.Offset(0, 4) = Now()
Application.EnableEvents = True
End Sub
The code was running smoothly, however recent usage has been giving a Run-time error 13. I've worked the mismatch error is occuring between v (string) & Target.Value (variant), but I'm wondering what the easiest way is to fix this mismatch?
Thanks for your time!
Ben