View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
WIJ WIJ is offline
external usenet poster
 
Posts: 6
Default searching the entire workbook after scanning a Barcode

Thanks for the code. Sorry for not explaning myself properly.

I want the macro to take me to the location(select the cell) of where the
barcode is, if I think that it is a double up then I want to be able to keep
searching.

Also when I scan the barcode, I want to be able to press enter(move off the
active cell) and the search starts automatically.


"joel" wrote:


You didn't say what you wanted done with the results so I put the
addresses in a message box.

Sub FindBarCode()

BarCode = Sheets("Sheet1").Range("A1")

'skip sheet 1 and located all occurances of Bar Code
For Each sht In Sheets
If sht.Name < "Sheet1" Then
Set c = sht.Cells.Find(what:=BarCode, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
FirstAddr = c.Address
Do
Set c = sht.Cells.FindNext(after:=c)
If Not c Is Nothing Then
MsgBox ("BarCode : " & BarCode & _
" found at location : " & c.Address(external:=True))
End If
Loop While Not c Is Nothing And c.Address < FirstAddr

End If
End If

Next sht

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=162180

Microsoft Office Help

.