View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
StargateFan[_3_] StargateFan[_3_] is offline
external usenet poster
 
Posts: 171
Default VB coding for showing "find" dialogue box?

On Tue, 8 Jun 2004 07:05:45 -0700, "Bridget"
wrote:

The MS ng site is so awful for finding things. I have the
Google archive of the msg open next to this one and did
various searches for items found in the msg, but the ms ng
search _doesn't_ bring up anything pertinent <sigh. Very
frustrating. So I'm going to copy/paste, if that's okay
from the google message:


(Working from home again; wish they'd allow us to install Agent at the
office! <g)

Is there a way to get the coding with no word wrap so that it works,
Fred (or anyone)?

Thank you so much!

"From: Fred_is_stuck < (Fred_is_stuck.17ilo8@excelforum-
nospam.com)
Subject: VB coding for showing "find" dialogue
box?


View this article only
Newsgroups: microsoft.public.excel.programming
Date: 2004-06-07 21:36:59 PST


hi there Stargatefan,

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

I can't take credit for this coding and I can't give
credit to the
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.", "Search
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
on
this sheet :o( ", , "Totally Unsuccessful search"
Else
MsgBox Err.Number & ": " & Err.Description
End If
End Sub


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


This one seemed very promising and I believe it will work
as Fred says it does for him. What the difficulty is is
the word wrap. When the macro failed and I suddenly
realized why so many of the lines showed up red, it made
sense that there was word wrap that there shouldn't have
been. I messed about trying to fix this myself, but I
still get a lot of compiling errors.

Do you, Fred, or anyone know where this code can be found
on a webpage so that I can copy it intact?

Thanks so much; really appreciate all the help.