Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Learning how to use 'Cells.Find()'


I'm learning how to use the "Cells.Find()" VBA function. I have th
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 workin
?
2 - where can I find more documentation on this Cells.Find() functio
?

Thanks in advance for any assistance

--
Welli
-----------------------------------------------------------------------
Wellie's Profile: http://www.excelforum.com/member.php...fo&userid=1537
View this thread: http://www.excelforum.com/showthread.php?threadid=27403

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Learning how to use 'Cells.Find()'

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Macros starguy Excel Discussion (Misc queries) 1 March 24th 06 12:10 PM
Learning Excel VBA mak Excel Discussion (Misc queries) 6 August 25th 05 03:42 AM
Learning resource for VBA Mike[_58_] Excel Programming 2 November 25th 03 09:24 PM
Just learning VBA.. Deb Lang Excel Programming 1 October 22nd 03 11:46 PM
Learning VBA Randy Harris Excel Programming 2 September 6th 03 10:59 PM


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"