tales of woe

S

sds

I have a barcode scanner that scans information into
excel, but in the first cell, A1. I want to create a
spreadsheet so A1 will be a title (e.g.Barcode) how can i
get it to scan straight into A2. Also how can then i get a
time logged into the next box B2 every time i scan a
barcode??
Thanks in advance
 
T

Tom Ogilvy

Depends on how your barcode scanner is transmitting the information to
excel. If it is simulating keyboard input, then you would activate the cell
where you want the input. You would then use the change event to place a
time in the adjacent cell.

Right click on the sheet tab and select view code. Put in code similar to
this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 then exit sub
If Target.Column = 1 And Target.Row > 1 Then
If Target.Offset(0, 1) = "" Then
Target.Offset(0, 1).Value = Date
Target.Offset(0, 1).NumberFormat = "mm/dd/yyyy"
End If
Next
End Sub
 
T

Tom Ogilvy

I had a typo - here is a revision:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row > 1 Then
If Target.Offset(0, 1) = "" Then
Target.Offset(0, 1).Value = Date
Target.Offset(0, 1).NumberFormat = "mm/dd/yyyy"
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