Step 1 – Prepare the Worksheet for Data Entry
- Create a data table to place the Barcode Numbers (B5:B14) and to automatically enter Date & Time (C5:C14).
Read More: How to Use Barcode Scanner in Excel
Step 2 – Open the Visual Basic Window
- Go to the Developer tab and select Visual Basic.
- In the Visual Basic window, double-click Sheet1.
- Select Worksheet as the object sheet.
- Select Change as the VBA event.
Read More: How to Use Barcode Scanner for Inventory in Excel
Step 3 – Use the VBA Code
- Enter this VBA Macro code in the blank sheet.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim TableRange As Range
Dim DateTimeRange As Range
Set TableRange = Range("B5:B14")
If Intersect(Target, TableRange) Is Nothing Then Exit Sub
Set DateTimeRange = Range("C" & Target.Row)
If DateTimeRange.Value = "" Then
DateTimeRange.Value = Now
End If
End Sub
- Click Save and close the Visual Basic window.
Read More: Barcode Scanner Entry to Excel Database with Timestamp
Step 4 – Run the Auto Enter Barcode Scanner Code
- Enter your barcode number in B5.
- Press Enter.
- Date & Time is automatically displayed in C5.
- Enter each number to get the final output.
Read More: How to Move Barcode Scanner to Next Row in Excel
Download Practice Workbook
Practice here.
Related Articles
- Creating Barcode Scanner to Track Check in & Check out Time in Excel
- How to Print Barcode Labels in Excel
- [Solved] Barcode Scanner Not Going to Next Line in Excel
- Creating a Barcode Scanner Macro in Excel
<< Go Back to Use Barcode Scanner | Barcode in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!