Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rub rub is offline
external usenet poster
 
Posts: 21
Default using find method after using it earlier

I use the find method to find a cell. I copy the contents of the
cells. Later I use the find method to find a different string. At
this point it find the first string or sometimes gives me an error that
object not found. Any ideas. Is there a way to clear a register hold
the first string?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default using find method after using it earlier

I can't see you code, but it could be that you don't set all the options or
you could be searching after the activecell and that isn't located where you
think.

Sub SubFindIt()
sStr = "ABC"
Set rng = Cells.Find(What:=sStr, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
MsgBox sStr & " found at " & rng.Address
Else
MsgBox sStr & " not found"
End If
End Sub

would be a good way to do the search. Obviously, consult the help on find
and adjust the arguments to meet your needs.

Also, I assume you are using Find and not FindNext. You wouldn't want to
use findnext if you are changing what you are searching for.

--
Regards,
Tom Ogilvy



"rub" wrote in message
ups.com...
I use the find method to find a cell. I copy the contents of the
cells. Later I use the find method to find a different string. At
this point it find the first string or sometimes gives me an error that
object not found. Any ideas. Is there a way to clear a register hold
the first string?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default using find method after using it earlier

when your'e using this Find command is there a way to copy what your looking
for plus the eight cells next to the word?

Tom Ogilvy wrote:
I can't see you code, but it could be that you don't set all the options or
you could be searching after the activecell and that isn't located where you
think.

Sub SubFindIt()
sStr = "ABC"
Set rng = Cells.Find(What:=sStr, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
MsgBox sStr & " found at " & rng.Address
Else
MsgBox sStr & " not found"
End If
End Sub

would be a good way to do the search. Obviously, consult the help on find
and adjust the arguments to meet your needs.

Also, I assume you are using Find and not FindNext. You wouldn't want to
use findnext if you are changing what you are searching for.

I use the find method to find a cell. I copy the contents of the
cells. Later I use the find method to find a different string. At
this point it find the first string or sometimes gives me an error that
object not found. Any ideas. Is there a way to clear a register hold
the first string?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200610/1

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
How do I find and reopen an excel file I created earlier? Happy Grandma Excel Discussion (Misc queries) 2 January 28th 09 10:56 PM
date find using find method x taol Excel Programming 2 December 22nd 05 09:51 AM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM
Find method Alan Beban[_2_] Excel Programming 0 September 22nd 04 09:38 PM
The Find Method Brad[_7_] Excel Programming 0 July 16th 03 03:23 PM


All times are GMT +1. The time now is 09:04 AM.

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"