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.
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
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