Hello everyone!
I am trying to build an excel macro that records a date and time a package is scanned. I also want to record the time the package leaves.
I am using a barcode scanner to record the package tracking number and I found this handy code that timestamps the package when its scanned (Check In time)
However, I cannot figure out how to have scan the same package number and record a Check Out time on the same row.
So Column "A" is Package # Column "B" Check In time Column "C" Check Out time.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
With Target
If .Value <> "" Then
.Offset(0, 1).Value = Format(Now, "mm/dd/yyyy hh:mm:ss AM/PM")
End If
End With
End If
enditall:
Application.EnableEvents = True
End Sub
Any help would be greatly appreciated as I am just starting with VBA.
Thanks,
Christian
Bookmarks