![]() |
Auto go to beginning of next row after "n"th cell is populated??
I am scanning 4 barcodes to 4 cells then I need to drop to the
beginning of the next row to scan 4 more, ect. ect., is there a formula for doing this or is it like a macro or something? Thank you, Dan |
Auto go to beginning of next row after "n"th cell is populated??
Well, this is totally independent of whatever is going on to get your scanned
barcodes into the proper cells. What it will do is move down 1 row and back to the left 3 columns when an entry is made into a column you specify (the 4th column). I've used D for that column which will make it move down and back to column A, but if you are entering bar codes into B:E, just change the "D" to "E" and it'll work. The code is triggered by a change in the cell on a worksheet, and so the code must go into the worksheet's event module. To get the code where it needs to be, open the workbook. Choose the sheet where you're entering the barcodes. RIGHT-click on the sheet's name/tab and choose [View Code] from the list that appears. Copy the code below and paste it into the code module presented to you. Close the VB Editor and try it out. Private Sub Worksheet_Change(ByVal Target As Range) 'looks for a change in the specified column, and 'if it took place there, it drops to the next row 'and over 4 columns to the left. So the specified 'column cannot be A, B or C. Const triggerColumn = "D" 'we only want to do this if: ' only a single cell has changed ' it is in our trigger column 'Assumption: that when the value in the 'trigger column changes, there are already 'entries in the previous 3 cells on the row. If Target.Column < Range(triggerColumn & 1).Column _ Or Target.Cells.Count 1 Then Exit Sub End If 'ok, in right column and only 1 cell affected 'go down 1 row, to the left 3 columns Target.Offset(1, -3).Activate End Sub "Dan" wrote: I am scanning 4 barcodes to 4 cells then I need to drop to the beginning of the next row to scan 4 more, ect. ect., is there a formula for doing this or is it like a macro or something? Thank you, Dan |
All times are GMT +1. The time now is 10:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com