I need to add "enter" after each scan

Marwan22

New Member
Joined
Apr 14, 2022
Messages
11
Office Version
  1. 2010
Platform
  1. Windows
Hi, I need to automatically move down after each time I use the barcode scanner, I need to do this by VBA.
IT department has nothing to do with the device.

For example, my selected cell is A1, I need to automatically move to A2 after scanning the item.

Thanks you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I wonder how a scanner can access Excel on your device.
If it is an Android device, you won't have VBA in Excel for Android.

How do you get a value from barcode scanner to a cell in Excel?
 
Upvote 0
I wonder how a scanner can access Excel on your device.
If it is an Android device, you won't have VBA in Excel for Android.

How do you get a value from barcode scanner to a cell in Excel?
It's not android, it's windows, and I just plug an usb scanner to my laptop with opened excel file to use it.
 
Upvote 0
Usually that setting has to be programmed into the scanner itself. Most barcode scanners will come with a sheet of barcodes to scan for programming. Check your users manual.
 
Upvote 0
Usually that setting has to be programmed into the scanner itself. Most barcode scanners will come with a sheet of barcodes to scan for programming. Check your users manual.
ok, Is it possible to write a VBA code that works as follow: if any change happend in column A select to first empty cell in column A. is this possible?
 
Upvote 0
ok, Is it possible to write a VBA code that works as follow: if any change happend in column A select to first empty cell in column A. is this possible?
Try this code on your worksheet.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim ActiveBarCodeScan As Boolean, BarCodeColumn As String
    
    ActiveBarCodeScanEvents = True   '<-- Change to false to disable feature.
    BarCodeColumn = "A"              '<-- Change this to you barcode column.
    
    If Split(ActiveCell.Address, "$")(1) = BarCodeColumn Then
        If Trim(ActiveCell.Value) <> "" And ActiveBarCodeScanEvents = True Then
            Range(Split(ActiveCell.Address, "$")(1) & Split(ActiveCell.Address, "$")(2) + 1).Select
        End If
    End If
End Sub
 
Upvote 0
Solution
Try this code on your worksheet.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim ActiveBarCodeScan As Boolean, BarCodeColumn As String
   
    ActiveBarCodeScanEvents = True   '<-- Change to false to disable feature.
    BarCodeColumn = "A"              '<-- Change this to you barcode column.
   
    If Split(ActiveCell.Address, "$")(1) = BarCodeColumn Then
        If Trim(ActiveCell.Value) <> "" And ActiveBarCodeScanEvents = True Then
            Range(Split(ActiveCell.Address, "$")(1) & Split(ActiveCell.Address, "$")(2) + 1).Select
        End If
    End If
End Sub
This seemed fine, Thank you Trixterz and everybody for your help.
 
Upvote 0

Forum statistics

Threads
1,215,154
Messages
6,123,327
Members
449,098
Latest member
thnirmitha

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