sub Test()
Dim rng as Range
set rng = FindStr("Mystring")
if not rng is nothing then
rng.Select
else
msgbox "Mystring not found"
End if
end sub
sub FindStr(strx as String) as Range
set FindStr = Cells.Find(What:=strx)
end sub
Find is fully documented in excel vba help.
It basically is the same as Edit=find done manually.
--
Regards,
Tom Ogilvy
"Wellie" wrote in message
...
I'm learning how to use the "Cells.Find()" VBA function. I have the
following simply routine:
sub Test()
Call FindStr("Mystring")
end sub
sub FindStr(strx as String)
Cells.Find(What:=strx).activate
end sub
When I run the Test() sub. I received the following error:
Run-time error '91':
Object variable or With Block variable not set
Can someone please
1 - tell me what am I missing here to get this simply routine working
?
2 - where can I find more documentation on this Cells.Find() function
?
Thanks in advance for any assistance.
--
Wellie
------------------------------------------------------------------------
Wellie's Profile:
http://www.excelforum.com/member.php...o&userid=15370
View this thread: http://www.excelforum.com/showthread...hreadid=274034