tales of woe

  • Thread starter Thread starter sds
  • Start date Start date
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
 
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
 
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
 
Back
Top