FIND A TEXT IN A WORKSHEET NOT IN A COLUMN OR ROW BY FORMULA
By coincidence, I posted this code yesterday:
This code looks for the string "asdf" in the current worksheet and
displays a message box with the address when it is found. If the
string is not found it advises the user, as well. You can substitute
your search string as a variable or as a hardcoded entry.
Note this Usenet interface word wraps, so you may need to adjust the
line breaks.
Sub Find()
On Error GoTo NotFound:
Cells.Find(What:="asdf", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
MsgBox ActiveCell.Address
End
NotFound:
MsgBox ("Search target not found.")
End Sub
|