Hi legends,
I have these 2 macros I modified from around the place and when I was testing separately on 2 sheets both worked great.
I've tried to put them together but now after the barcode scanner scans 3 spaces it drops down a row and back 3 columns until scanned then it jumps up and right 1 cell.
so its supposed to start at column B and remove a letter from the end of the barcode when scanned either A,B,C or D.
Then when scanning from Column B 3 times drop down to a new row and back to the original column B and repeat
please any help would be amazing here it is
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Call Worksheet_Change1(Target)
Call Worksheet_Change2(Target)
End Sub
Private Sub Worksheet_Change1(ByVal Target As Range)
If Intersect(Target, Range("B12:B27")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application
.EnableEvents = False
.ScreenUpdating = False
If Right(Target, 1) = "A" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "B" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "C" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "D" Then Target = Left(Target, Len(Target) - 1)
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Private Sub Worksheet_Change2(ByVal Target As Range)
On Error GoTo Exit_Clean
Application.EnableEvents = False
If Target.Row > 11 And Target.Column = 4 Then
ActiveCell.Offset(1, -3).Select
End If
Application.EnableEvents = True
Exit_Clean:
Application.EnableEvents = True
On Error GoTo 0
End Sub
I have these 2 macros I modified from around the place and when I was testing separately on 2 sheets both worked great.
I've tried to put them together but now after the barcode scanner scans 3 spaces it drops down a row and back 3 columns until scanned then it jumps up and right 1 cell.
so its supposed to start at column B and remove a letter from the end of the barcode when scanned either A,B,C or D.
Then when scanning from Column B 3 times drop down to a new row and back to the original column B and repeat
please any help would be amazing here it is
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Call Worksheet_Change1(Target)
Call Worksheet_Change2(Target)
End Sub
Private Sub Worksheet_Change1(ByVal Target As Range)
If Intersect(Target, Range("B12:B27")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application
.EnableEvents = False
.ScreenUpdating = False
If Right(Target, 1) = "A" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "B" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "C" Then Target = Left(Target, Len(Target) - 1)
If Right(Target, 1) = "D" Then Target = Left(Target, Len(Target) - 1)
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Private Sub Worksheet_Change2(ByVal Target As Range)
On Error GoTo Exit_Clean
Application.EnableEvents = False
If Target.Row > 11 And Target.Column = 4 Then
ActiveCell.Offset(1, -3).Select
End If
Application.EnableEvents = True
Exit_Clean:
Application.EnableEvents = True
On Error GoTo 0
End Sub