Jak68
New Member
- Joined
- Jan 21, 2016
- Messages
- 17
Hi, I have a spreadsheet with a few hundred items on it and these items are occiasonally getting sent out and then returning to me and I want to to book them in and then out so I know what is happening.
I currently have a tab with all of the items on it and then I have created a new tab for booking these items in.
Ideally I would like to scan the QR code which has a unique id number and then the scan will transfer the unique id into a cell, then the next column (column 'B') to show the date and time when the scan happens, when the items returns I would like to scan the QR code again to book the item back in with the date and time (column 'C')
I currently have a macro which works ok but I wanted it to work automatically if possible as I currently scan the QR code into cell E1 and then press control 'L', this then puts the unique id into column 'A' if not already there and the date and time into column 'B' and then if the unique id is referenced in column 'A' it will put the date and time into column'C' next to the correct id.
Here is the macro that is generated, is it possible to change this so I can just scan the QR code putting the date and time automatically when booking in and out but keeping the information next to each other
Hope this makes sense
Cross posted https://www.excelforum.com/excel-programming-vba-macros/1264952-macro-for-scanning-qr-codes.html
I currently have a tab with all of the items on it and then I have created a new tab for booking these items in.
Ideally I would like to scan the QR code which has a unique id number and then the scan will transfer the unique id into a cell, then the next column (column 'B') to show the date and time when the scan happens, when the items returns I would like to scan the QR code again to book the item back in with the date and time (column 'C')
I currently have a macro which works ok but I wanted it to work automatically if possible as I currently scan the QR code into cell E1 and then press control 'L', this then puts the unique id into column 'A' if not already there and the date and time into column 'B' and then if the unique id is referenced in column 'A' it will put the date and time into column'C' next to the correct id.
Here is the macro that is generated, is it possible to change this so I can just scan the QR code putting the date and time automatically when booking in and out but keeping the information next to each other
Hope this makes sense
Code:
Sub ScanTag()
Dim x As Integer
Dim isnew As Boolean
isnew = True
For x = 3 To 300
If Cells(x, 1).Value = Cells(1, 5).Value Then
isnew = False
Cells(x, 3).NumberFormat = "dd/mm/yyyy h:mm AM/PM"
Cells(x, 3).Value = Date & " " & Time
Exit For
End If
If Cells(x, 1).Value = "" Then
Exit For
End If
Next
If isnew Then
Cells(x, 1).Value = Cells(1, 5).Value
Cells(x, 2).Value = Date & " " & Time
End If
End Sub
Cross posted https://www.excelforum.com/excel-programming-vba-macros/1264952-macro-for-scanning-qr-codes.html
Last edited by a moderator: