How to create a scanner barcode timesheet in excel


Im working on creating a employee timesheet  in excel. I have a scanner connected my laptop.

What I want to do is scanned their badge that contains their employee number and in another cell name time the time will appear.

does anybody know what formula I can use that the time and date will appear on a cell when I can the badge.
Who is Participating?
tdlewisConnect With a Mentor Commented:
The subroutine that follows will update the cell in column B to the current time whenever a cell in column A is changed. Add the routine to the worksheet.
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 1 Then
        Target.Cells(1, 2).Value = Now()
    End If
End Sub

Open in new window

Let me know if you need help adding the code to your worksheet.

Also, if you want to look a column other than "A" then change the value in the If statement to match the column you want (A=1, B=2, etc.).

The code updates the adjacent column (to the right) to the current date/time. If you wanted a different column, change to "2" to indicate how far over from the current cell (which is always "1") it should move.
mark_harris231Connect With a Mentor Commented:
This formula will return the current date/time based on a non-blank entry in the reference cell:


The formula checks to see if the reference cell (A1) contains a value.  If it does, the function NOW() returns the current date and time.  If the reference cell is blank, the formula returns nothing (i.e., remains "blank").

You'll have to format the column/cell to the desired date/time format.
tdlewisConnect With a Mentor Commented:
@mark_harris231, that formula gets recalculated every time Excel performs calculations on the worksheet. Every time a badge was scanned, it would update the time in every row to the current time.
LENEROAuthor Commented:
thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.