Automatically generate timestamps when barcode scanned in Excel

Automatically generate timestamps when barcode scanned in Excel
People are looking for hands free entering of in and out timestamps when scanning barcodes. In this code there in no need to click a button, it will automatically run when the bar code cell changes. Track in and out times when bar code is scanned Automatically.
Check out my online courses

Code for on the worksheet
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range(“B2”)) Is Nothing Then
Application.EnableEvents = False
Call inout
Application.EnableEvents = True
End If

End Sub

code for the macro
Sub inout()
Dim barcode As String
Dim rng As Range
Dim rownumber As Long

barcode = Worksheets(“Sheet1”).Cells(2, 2)

Set rng = Sheet1.Columns(“a:a”).Find(What:=barcode, _
LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If rng Is Nothing Then
ActiveSheet.Columns(“a:a”).Find(“”).Select
ActiveCell.Value = barcode
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date & ” ” & Time
ActiveCell.NumberFormat = “m/d/yyyy h:mm AM/PM”
Worksheets(“Sheet1”).Cells(2, 2) = “”
Else
rownumber = rng.Row
Worksheets(“Sheet1″).Cells(rownumber, 1).Select
ActiveCell.Offset(0, 2).Select
ActiveCell.Value = Date & ” ” & Time
ActiveCell.NumberFormat = “m/d/yyyy h:mm AM/PM”
Worksheets(“Sheet1”).Cells(2, 2) = “”

End If
Worksheets(“Sheet1”).Cells(2, 2).Select

End Sub

For more help visit my website or email me at [email protected].

Contact me regarding customizing this template for your needs.

Excel one-on-one on-line training available. Email me to arrange.

I am able to provide online help on your computer at a reasonable rate.

Check out my next one-hour Excel Webinar

I use a Blue condensor Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

Follow me on Facebook

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.

Rate this post