Hello,
I'm new to the forum, but I use the site for help all the time. Usually I am able to figure it out based on other issues threads, but this one has me stumped.
I am looking to run two subs, one to remove extra characters on the barcode scan itself (see below for code).
Private Sub Worksheet_Change2(ByVal Target As Range)
If Intersect(Target, Range("A2:A10000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application2
.EnableEvents = False
.ScreenUpdating = False
If Left(Target, 1) = "G" Then Target = Left(Target, Len(Target) - 7)
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
this works fine on its own.
Then I am also looking to add a date and timestamp to the column next to it (see code below)
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A2:A3000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Dim lc As Long
With Application
.EnableEvents = False
.ScreenUpdating = False
lc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If lc = 1 Then
Cells(Target.Row, lc + 1) = Format(Now, "m/d/yyyy - h:mm")
ElseIf lc > 2 Then
Cells(Target.Row, lc + 2) = Format(Now, "m/d/yyyy - h:mm")
End If
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
this also works by itself.
But I haven't been able to find a way to make the two changes together. PLEASE HELP ME!
Thank you,
Steve
I'm new to the forum, but I use the site for help all the time. Usually I am able to figure it out based on other issues threads, but this one has me stumped.
I am looking to run two subs, one to remove extra characters on the barcode scan itself (see below for code).
Private Sub Worksheet_Change2(ByVal Target As Range)
If Intersect(Target, Range("A2:A10000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With Application2
.EnableEvents = False
.ScreenUpdating = False
If Left(Target, 1) = "G" Then Target = Left(Target, Len(Target) - 7)
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
this works fine on its own.
Then I am also looking to add a date and timestamp to the column next to it (see code below)
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A2:A3000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Dim lc As Long
With Application
.EnableEvents = False
.ScreenUpdating = False
lc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If lc = 1 Then
Cells(Target.Row, lc + 1) = Format(Now, "m/d/yyyy - h:mm")
ElseIf lc > 2 Then
Cells(Target.Row, lc + 2) = Format(Now, "m/d/yyyy - h:mm")
End If
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
this also works by itself.
But I haven't been able to find a way to make the two changes together. PLEASE HELP ME!
Thank you,
Steve