Barcode scan matching two scans with date and time stamp

Olympus64

New Member
Joined
Oct 13, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I am new to vba coding and having trouble. I want to be able to scan two barcodes (Col A and Col B) capturing the instructions (Col C) to "ship" if the barcodes match, and "Do not ship" if the barcodes do not match. I need the date and time stamp (Col D) after the condition has been met in Col C.

1634579251955.png

VBA Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Integer
For x = 2 To 100
Dim xx As Integer
For xx = Range("c:c").Select
If Cells(x, 1).Value = Cells(x, 2).Value = "" Then
Cells(x, 4).Value = Date & " " & Time
Cells(x, 4).NumberFormat = "m/d/yyyy h:mm AM/PM"
End If
Next

If Range("A2") = "" Or Range("B2") = "" Then
Range("xx") = "-"
ElseIf Range("A2") = Range("B2") Then
Range("xx") = "Ship"
Else
Range("xx") = "Do Not Ship"
End If

Range("D:D").EntireColumn.AutoFit

End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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