Barcode ID scanned and inserted on another sheet and time inserted

sherrcha

New Member
Joined
Mar 3, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hey Team,

I was just wondering if the was a way to use VBA to accomplish this task I am trying to finish.

So I have a break tracker right? This break tracker is used for employees at my site. When they scan out for break it records the time they scanned out. Then when they get back from break they and scan back in on a different sheet it tells them where they are going to be for the rest of their shift...What I am wondering is this:

Can I get the scan to also:
1) Find the user id from the previous scan and
2) Insert the time the 2nd scan happened.

So:
User Scans out (Records Time) -> User Scans in (Records Time)

This is what I have for the Timestamp stuff so far.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Timestamp Data

Dim myTableRange As Range
Dim myDateTimeRange As Range
Dim myUpdatedRange As Range

'Your data table range
Set myTableRange = Range("A2:B500")

'Check if the changed cell is in the data table or not.
If Intersect(Target, myTableRange) Is Nothing Then Exit Sub

'Stop events from running
Application.EnableEvents = False

'Column for the date/time
Set myDateTimeRange = Range("C" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange = Range("D" & Target.Row)

'Determine if the input date/time should change
If myDateTimeRange.Value = "" Then

    myDateTimeRange.Value = Now

End If

'Update the updated date/time value
'myUpdatedRange.Value = Now

'Turn events back on
Application.EnableEvents = True
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

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