phone lists

J

jbg

I have a list of 240 names and numbers. lokking for a template for excel or
word that would allow me to search


JBG
 
F

FSt1

hi,
If search is all you want, is there a problem with xl's find function?

Regards
FSt1
 
F

FSt1

hi,
yes. this code will search all sheets. you will have to modify to fit your
data/sheets.
Private Sub CommandButton2_Click()
Dim sStr As String
Dim SH As Worksheet
Dim Rng As Range

Sheets("xlcode").Select
sStr = InputBox("Enter item to search for")
For Each SH In ThisWorkbook.Worksheets
If sStr <> "" Then
Set Rng = Nothing
Set Rng = SH.Range("A1:IV65536").Find(What:=sStr, _
After:=SH.Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End If
If Not Rng Is Nothing Then
SH.Activate
Rng.Select
MsgBox "Found on sheet " & SH.Name & " at cell " & _
Rng.Address

'Exit Sub
End If
Next SH
If Rng Is Nothing Then
MsgBox sStr & " was Not found"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top