Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Find

Status
Not open for further replies.

clayton74

Technical User
Apr 17, 2002
187
GB
Hello all
I have a workbook with 10 worksheets,in column "a" in all worksheets I have various part numbers. Is there some vba I could use that will first select all worksheets and second have a find function to find a part number that may be entered in an input box

Thanks
Andy
 
Try something like this
Sub Finder()
Dim mPartNo
mPartNo = InputBox("Enter Part Number")
For i = 1 To 10

Set foundcell = Sheets(i).Columns("A").Find(mPartNo)
If foundcell Is Nothing Then
Else
MsgBox "Part Number " & mPartNo & " found on sheet " & Sheets(i).Name & " in cell " & foundcell.Address
Exit Sub
End If
Next i
MsgBox "Part Number " & mPartNo & " not found"
End Sub

HTh
Geoff
 
Works grand thanks Geoff. I wish to go to the worksheet/cell that is displayed in msgbox. I apologise if I am asking to much

Andy
 
ok
Sub Finder()
Dim mPartNo
mPartNo = InputBox("Enter Part Number")
For i = 1 To 10

Set foundcell = Sheets(i).Columns("A").Find(mPartNo)
If foundcell Is Nothing Then
Else
sheets(i).select
range(foundcell.address).select
Exit Sub
End If
Next i
MsgBox "Part Number " & mPartNo & " not found"
End Sub

HTH
Geoff
 
You are a god amongst gods thanks for your assistance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top