View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Fred_is_stuck[_2_] Fred_is_stuck[_2_] is offline
external usenet poster
 
Posts: 1
Default VB coding for showing "find" dialogue box?

hi there Stargatefan,

I use this coding in my spreadsheets..... it finds every instance o
what im looking for on a sheet without fail.... if the data exists tha
is lol.

I can't take credit for this coding and I can't give credit to th
original coder as I don't know whom that was.

Hope it is of use to you.

you'll just need to copy it to a module


sub findthis()
Dim MyValue, MyFindNext
[A1].Select
MyValue = InputBox("Type in what you are Searching for.", "Searc
for...")
On Error GoTo err_Trap
Cells.Find(What:=MyValue, After:=ActiveCell, LookIn:=xlFormulas
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
MatchCase:=False).Activate
MyFindNext = vbYes
Do Until MyFindNext < vbYes
MyFindNext = MsgBox("Want to search for " & MyValue & " Again?", _
vbYesNo, "Find Next")
If MyFindNext = vbNo Then
Exit Sub
End If
Cells.FindNext(After:=ActiveCell).Activate
Loop
On Error GoTo 0
Exit Sub
err_Trap:
If Err.Number = 91 Then
MsgBox "Awwww Sorry couldn't find " & MyValue & " anywhere o
this sheet :o( ", , "Totally Unsuccessful search"
Else
MsgBox Err.Number & ": " & Err.Description
End If
End Su

--
Message posted from http://www.ExcelForum.com