How to I automatically move cells (A1, B1, A2, B2) using a barcode scanner and also record the time of data entry

KeriM

New Member
Joined
Nov 1, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
How to I automatically move cells (A1, B1, A2, B2) using a barcode scanner and also record the time of data entry? To give more clarity, I work in a warehouse and I want the staff to sign out for their handheld devices. Column A will contain their names, and Column B will contain the device name, Column C will need to have the time of signing in, Column D will need to have the department
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi and welcome a-board.
Assuming you have something like this alread beacuse you want to use barcodes:
Munkafüzet1
ABCDEFGHIJK
1Namedevicetimestampdeptname barcodenamesdeptDevice barcodeDevice
21Johndept11Dev1
32Jhondept12Dev2
43Jnohdept23Dev3
54Jhnodept24Dev4
Munka1

I would do a userform like this:
1604322673265.png

green = textbox; yellow = labels; purpleish =button

And the userform code:
VBA Code:
Private Sub btn_apply_Click()
lrc = Range("C" & Rows.Count).End(3).Row + 1
Range("A" & lrc).Value = lbl_name_result.Caption
Range("A" & lrc).Value = lbl_device_result.Caption
Range("A" & lrc).Value = Format(Now, "yyyy-mm-dd hh:nn:ss")
Range("A" & lrc).Value = lbl_dept_result.Caption

lbl_dept_result.Caption = ""
lbl_device_result.Caption = ""
lbl_name_result.Caption = ""
Application.EnableEvents = False
tb_device_barcode.Value = ""
tb_name_barcode.Value = ""
Application.EnableEvents = True

End Sub

Private Sub tb_device_barcode_Change()
On Error Resume Next
lri = Range("J" & Rows.Count).End(xlUp).Row
d_name = Range("J1:J" & lrg).Find(tb_device.Text, lookat:=xlWhole).Offset(0, 1).Value
lbl_device_result.Caption = d_name
On Error GoTo -1
lbl_timestamp.Caption = Format(Now, "yyyy-mm-dd hh:nn:ss")
End Sub

Private Sub tb_name_barcode_Change()
On Error Resume Next
lrg = Range("G" & Rows.Count).End(xlUp).Row
u_name = Range("G1:G" & lrg).Find(tb_name.Text, lookat:=xlWhole).Offset(0, 1).Value
dept_name = Range("G1:G" & lrg).Find(tb_name.Text, lookat:=xlWhole).Offset(0, 2).Value
lbl_name_result.Caption = u_name
lbl_dept_result.Caption = dept_name

On Error GoTo -1
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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