Thread: How to auto tab
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
L. Howard Kittle L. Howard Kittle is offline
external usenet poster
 
Posts: 698
Default How to auto tab

Hi Joel,

Use something like this. If something is scanned into column A, then this
macro will fire and you will get the message. Or you can call a macro to do
what you want with the scanned entry which is what I did by calling
StudentID, (which I have edited out here).

So in my example once a student ID number is scanned into column 1 the
macro StudentID is called and the date and time and student information is
entered in that row. The StudentID macro draws it's info from a data base
on sheet 2 and commits it to sheet 1.

I am not an expert but if you need help getting it set up you could send me
a sample workbook and I will give it a go. Provide plenty of details of
what you want to happen and where, etc. dump the xxx

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
Application.EnableEvents = False
'StudentID
MsgBox "I just scanned something"
Application.EnableEvents = True
End If
End Sub

Sub StudentID()
Dim FindVal As Variant
Dim fVal As Range

FindVal = Worksheets("Sheet1").Range("A65536").End(xlUp).Val ue
Set fVal = Worksheets("Sheet2").Columns("A").Find(FindVal)

If Not fVal Is Nothing Then
fVal.Offset(0, 1).Resize(1, 5).Copy _
Sheets("Sheet1").Range("D25000").End(xlUp).Offset( 1, 0)
ActiveCell.Offset(-1, 1) = Date
ActiveCell.Offset(-1, 2) = Time
End If
If ActiveCell.Offset(-1, 4).Value = "" Then
ActiveCell.Offset(-1, 3).Value = " No student data for this ID no."
ActiveCell.Offset(-1, 1) = ""
ActiveCell.Offset(-1, 2) = ""
End If
End Sub

HTH
Regards,
Howard

"Joel Ganger" <Joel
wrote in message
...
I use a handheld scanner to read barcodes. How do I make excel
automatically
tab to the next cell after input.