Barcode Scanner CheckIn/CheckOut - Stumped

cval

New Member
Joined
Mar 29, 2012
Messages
18
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.

Code:
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
 
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.

Code:
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

Your issue should be compatible with Excel 2007, right?
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,217,394
Messages
6,136,341
Members
450,005
Latest member
BigPaws

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