Need help with loop

L

Lane4

I have a worksheet with several thousand retail items listed wit
Description, Product Barcode, price, etc.

In cell J10, I want to scan in a barcode from a product. any product.

I then want to search the data to find a matching barcode and retur
the description and the price of that item. I have accomplished thi
by using the following formulas:

=VLOOKUP(J10,A2:C24890,2,FALSE) Returns description from column 2
and

=VLOOKUP(J10,A2:C24890,3,FALSE) Returns price from column 3.

Now I need for the cursor to automatically return to J10 so I can sca
in the next product barcode.

The scanner that I am using enters the 10 digit barcode number in th
cell where I have my cursor, then automatically goes to the cell to th
right. How do I set this up to return to the original cell (J10) to ge
ready for the next barcode.

Please help. I know that the answer is probably very obvious - I a
just looking over it
 
G

Gary Keramidas

right click on the sheet name and choose view code
paste this on the sheet code page

if k10 is selected, it should take you back to j10


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then
If Not Intersect(Target, Range("K10")) Is Nothing Then
Worksheets(1).Range("J10").Select
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top