I appreciate the effort, but the code you provided conflicts with the one I posted (the first line where it reads "Private Sub... ...Range)). I did however find another one that works, and this is what I now have:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Range("A1").Sort Key1:=Range("A2"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("D2:D5001").Copy
Range("B2").PasteSpecial Paste:=xlPasteValues
End If
End Sub
Though the above does what I want, there seems to be an unforeseen side effect. When I was testing it out, I scanned some barcodes and after the scan it would go to the next column. I changed the layout somewhat so that all the functions being performed were in the third and fourth columns, but the final pasted value is actually in the second column just to make it easier for other users. I also hid the third and fourth columns so it would be less confusing to newer users.
To check myself in regards to the issue I am having with it going into the second column, I rescanned the bar code for the scanner itself to ensure it was using a carriage return and not a tab after the scan, but it still goes to the second column. I even tried another method I found of protecting the columns so no changes would occur, but that isn't working either.
Is there some way I can get this to be more user friendly whereas the user only needs to scan each barcode, the next active cell to scan in becomes the below cell, the adjacent cells in the next column indicate the resulting value and all the while the sheet auto sorts?
Bookmarks