View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default automatically insert date when I scan an item

Greg

I don't know if event code works with a scanner or not but try this which places
the date into column A when B is populated.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module.


Gord Dibben MS Excel MVP

On Tue, 13 Feb 2007 13:38:01 -0800, GregB
wrote:

I just bought a scanner for the small inventory that I have and I am using
excel 2003. When I scan an item it inserts the barcode in one column. I would
like excel to automaticaly insert the date in the proceding column. How would
I accomplish this, Thanks!