Running a barcode tracker to track in and out times when scanning a barcode with a Zebra scanner. On the macro module, I'm getting an overflow 6 error when scanning a barcode in. The barcode comes in as never ending number symbols but when clicking into the cell itself, shows the 12 digit barcode number.
The line of code it is taking me to debug is:
barcode = Worksheets("Sheet1").Cells(2, 2)
This is the full code:
Sub inout()
Dim barcode As String
Dim rng As Range
Dim rownumber As Long
barcode = Worksheets("Sheet1").Cells(2, 2)
If barcode <> "" Then
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
again:
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
Sheet1.Cells(rownumber, 3). Select
ActiveCell.Interiot.ColorIndex = 4
If Worksheets("Sheet1").Cells(rownumber, 3).Value <> "" Then GoTo
again
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
End If
End Sub
Would anyone know how to fix this, please?
Trying to scan in barcode to enter in and out time. Barcode came in as never ending number symbols with an
overflow 6 error
in vba.
Try this out - comments inline: