Scan barcode to excel with date & time stamp in & out.

qpywsqp

New Member
Joined
Dec 2, 2012
Messages
26
Hi all. I have research around the internet and finally found out Macro able to solve my issue. But im totally not a programmer. Hopefully someone can help me on this.

I will scan QR Code with a scanner to cell A1 and wanted cell C1 to have date and time stamp for IN. When Scanner scan the same QR Code, D1 will have date and time stamp for out. If repeat third time scanning the same QR code after a few scanning, it will appear on next row. Which means A8 with the code and C8 with date and time stamp for IN again.

Is that possible to done with Macro?
 
Hi

Thanks for your help and quick answer.

1. i am using Win7 and office 2013
2. PC

Column A is barcode, B is first time and date column, H is the scond date and time
When i scan barcode, Barcode is written to Column A, and the date and time should be in B, when i scan the same barcode second time the date and time should be in coulmn H.

i have many barcodes, i wanna use this excel for filter follow-up in laboratory. instead of writing barcodes and date and time , i want to follow up this way

i tried to add excel to dropbox
https://www.dropbox.com/s/q1nv570e310lsno/F-119 ISG TARTIM SONUÇLARI FORMU (2).xlsm?dl=0
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
When i scan barcode, Barcode is written to Column A3, and the date and time should be in B3


when i scan the same barcode second time the date and time should be in column H.

benkimya,

1. In the same row, H3?

2. Or, can you scan the same barcode again in a different column A row?

2a. Then what should happen?
 
Upvote 0
Hi,

i changed your macro a bit and now i reupload the excel.
https://www.dropbox.com/s/q1nv570e310lsno/F-119 ISG TARTIM SONUÇLARI FORMU (2).xlsm?dl=0
i also scanned my barcode in excel to show what happens.
i always select column A while scanning a barcode then scanned it. barcode name is written to column A from row 1 to row2, row3...
but the problem is date and time stamp is written Column O, the 2nd scanned Column P, 3rd Column R ....
i want to stamp the date and time column B and Column H
i hope to tell my problem
Thanks
 
Upvote 0
benkimya,

We seem not to be able to understand each other.

You have not answered my questions?

See if the following will work for you.

I change the date and time format for the following to also show seconds.

If you scan in S00125A001 two times, you will get this. Is the following screenshot correct?

Here are some manual scans, and, results:


Excel 2007
ABCDEFGH
1BARKOD/ FILTRE KODUILK TARTIM (g)
2TIME&Date1. Tartim2. Tartim3. TartimORTALAMATartimi YapanTIME&Date
3S00125A00112/26/15 17:55:27#DIV/0!
4S00125A00212/26/15 17:55:36#DIV/0!
5S00125A00312/26/15 17:55:45#DIV/0!
6S00125A00412/26/15 17:55:50#DIV/0!
7S00125A10112/26/15 17:58:16#DIV/0!
8S00125A001#DIV/0!12/26/15 18:03:22
9#DIV/0!
10#DIV/0!
Sayfa1




Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' hiker95, 12/26/2015, ME672492
If Intersect(Target, Range("A2:A3000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Dim n As Long
With Application
  .EnableEvents = False
  .ScreenUpdating = False
  n = Application.CountIf(Columns(1), Cells(Target.Row, 1))
  If n = 1 Then
    If Cells(Target.Row, 2) = vbEmpty Then
      Cells(Target.Row, 2) = Format(Now, "mm/dd/yy h:mm:ss")
    Else
      Cells(Target.Row, 8) = Format(Now, "mm/dd/yy h:mm:ss")
    End If
  ElseIf n > 1 Then
    Cells(Target.Row, 8) = Format(Now, "mm/dd/yy h:mm:ss")
  End If
  .EnableEvents = True
  .ScreenUpdating = True
End With
End Sub
 
Upvote 0
Hi,

Thanks, macro is going better.
i am sorry, i cant tell what i what correctly.
i added your macro my excel and scanned my barcodes, and reupload to dropbox
https://www.dropbox.com/s/q1nv570e310lsno/F-119 ISG TARTIM SONUÇLARI FORMU (2).xlsm?dl=0

the problem is that;
First scan stamp the date and time in correct cell
The second scan add second S00125A001 barcode in column A. i dont want this
When i scan the same barcode secondly. it should be in H column in the same row (when it is scanned firstly)

Ex:
1st Scan: S00125A001 column A row 8, Time/Date Column B row8 , they are in the same row (row 8) . This is OK
2nd Scan: S00125A001 no need new rowin column A, time/date should be in column H row 8,

i mean that in the second scan , i dont want to be shown the same barcode secondly in column A
i added excel what should be
https://www.dropbox.com/s/83kfovwllly73wp/excel shoul be.xlsm?dl=0
 
Upvote 0
1st Scan: S00125A001 column A row 8, Time/Date Column B row8 , they are in the same row (row 8) . This is OK
2nd Scan: S00125A001 no need new rowin column A, time/date should be in column H row 8,

benkimya,

It sounds like, that you will never scan in S00125A001 a second time in another row in column A.

But, you will always scan in the same barcode in the same original cell.

If the above statements are correct, then, try the following:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' hiker95, 12/27/2015, ME672492
If Intersect(Target, Range("A2:A3000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application
  .EnableEvents = False
  .ScreenUpdating = False
  If Cells(Target.Row, 2) = vbEmpty Then
    Cells(Target.Row, 2) = Format(Now, "mm/dd/yy h:mm:ss")
  Else
    Cells(Target.Row, 8) = Format(Now, "mm/dd/yy h:mm:ss")
  End If
  .EnableEvents = True
  .ScreenUpdating = True
End With
 
Last edited:
Upvote 0
Hi,
i solved my problem and added excel below.

https://www.dropbox.com/s/rgrimvv5p5tuyks/excel shoul be - Kopya.xlsm?dl=0

In the first page (ISG Tartım), i have done i want. No Problem
i scanned the barcode two times in different times, they stamp the date and time in correct cells

But now i have a problem in the second page (Page1)
In this page i must scan the same barcode 4 times in different times. 1st and 2nd stamps are OK, but i dont know how to do the 3rd and 4th stamps to the yellow cells (I4 and H4).
 
Upvote 0
But now i have a problem in the second page (Page1)
In this page i must scan the same barcode 4 times in different times. 1st and 2nd stamps are OK, but i dont know how to do the 3rd and 4th stamps to the yellow cells (I4 and H4).

benkimya,

Let me see what I can come up with.

Be back later today, after I clean up the ice and snow from our first snow storm.
 
Upvote 0
benkimya,

Well, we have two inches of ice/snow, and, it is raining.

Sample new raw data, and, results:


Excel 2007
ABCDEFGHIJKL
1Barkod/ Filtre KoduTOZKALINTI
2Ilk TartimTartimi YapanSon TartimTartimi YapanFark (g)Ilk TartimTartimi YapanSon Tartim
3Tarih/ SaatMiktar (g)Tarih/ SaatMiktar (g)Tarih/ SaatMiktar (g)Tarih/ Saat
4287129.12.15 08:57:4229.12.15 08:57:4429.12.15 08:57:4629.12.15 09:02:06
5
Sayfa1


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' hiker95, 12/29/2015, ME672492
If Intersect(Target, Range("A4:A3000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application
  .EnableEvents = False
  .ScreenUpdating = False
  If Cells(Target.Row, 2) = vbEmpty Then
    Cells(Target.Row, 2) = Format(Now, "dd.mm.yy hh:mm:ss")
  ElseIf Cells(Target.Row, 5) = vbEmpty Then
    Cells(Target.Row, 5) = Format(Now, "dd.mm.yy hh:mm:ss")
  ElseIf Cells(Target.Row, 9) = vbEmpty Then
    Cells(Target.Row, 9) = Format(Now, "dd.mm.yy hh:mm:ss")
  ElseIf Cells(Target.Row, 12) = vbEmpty Then
    Cells(Target.Row, 12) = Format(Now, "dd.mm.yy hh:mm:ss")
  End If
  .EnableEvents = True
  .ScreenUpdating = True
End With
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top