Good day, I would like some help getting this code to also keep count of reoccurring information. Right now I have a scanner I use to scan a barcode, then it will enter the number the first column. It will then enter a timestamp in the second column. I am trying to get it to keep keep a count of how many times the same barcode is scanned.
I am very green to coding let alone coding in excel.
I found this code online and it has another part that if the same barcode is scanned to add a timestamp to the right of the first time is was scanned. It was meant to be used as a time in and time out sort of thing.
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
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
ActiveSheet.Range(Cells(rownumber, 6), Cells(rownumber, 17)).Find("").Select
Worksheets("Sheet1").Cells(2, 2) = ""
End If
Worksheets("Sheet1").Cells(2, 2).Select
End Sub
I asked the owner of this code for assistance in editing it to what I am asking but was just given this code, but not told where to put it.
ActiveSheet.Range(Cells(rownumber, 6), Cells(rownumber, 17)).Find("").Select
Is it even possible to have excel keep track of counts for matching barcodes?
Bookmarks