barcode to move to the next row

victorzun

New Member
Joined
Feb 19, 2022
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
we have 6 cells available in each row to put the operator number in each cell (we use a list of barcodes to enter their numbers),
not always the same amount of people work in a job so I don't always use the 6 cells availables,
I would like if I only occupy 1, 2, 3 , 4 or 5 cells can have a barcode with a certain value that when I scan that bar code it sends me to the next row.

I appreciate the help in advance
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
     'we have 6 cells available in each row to put the operator number in each cell (we use a list of barcodes to enter their numbers),
     'not always the same amount of people work in a job so I don't always use the 6 cells availables,
     'I would like if I only occupy 1, 2, 3 , 4 or 5 cells can have a barcode with a certain value that when I scan that bar code it sends me to the next row.
     'I appreciate the help in advance


     '************************************************
     ' Your new scanned barcode comes straight in A1 !!!!
     ' your 6 cells per row are column 4->9, D:I
     '************************************************
     Dim MyBarcodeScanner As Range: Set MyBarcodeScanner = Range("A1")

     If Intersect(Target, MyBarcodeScanner) Is Nothing Then Exit Sub     'no new barcode
     If MyBarcodeScanner.Value <> "1234567890" Then Exit Sub    'my barcode has not this specific value

     k = ActiveCell.Column                                      'column number activeCell
     If WorksheetFunction.Median(4, 9, k) <> k Then Exit Sub    'activecell isn't somewhere in the 4th until 9th column
     Application.Goto ActiveCell.Offset(1, 4 - k), 0            'goto next line, 4th column

End Sub
 
Upvote 0
Solution
Thank you very much,

What values i need to change in your macro to make it work, i attached a picture of what Im trying to do
 

Attachments

  • barcode.PNG
    barcode.PNG
    41.5 KB · Views: 17
Upvote 0
i have no clue.
What happens when you scan a barcode, what cell is triggered ? What should happen next ?
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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