#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Find errors

We are experiencing intermittent errors from "Finds" in
our macros. Generally these are when our macros have
performed over 200 searches. The Find suddenly fails
although if the search is performed on the worksheet it
achieves the find successfully. So while the data is
present, the search appears to have grown tired!

Is there a limit to the number of Finds allowed, or do
some buffers need clearing or is there some other solution
other than running the macro in sections to reduce the
volume of searches?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find errors

There is no limit that I have heard of.

Perhaps the conditions for the find are not being set explicitly and causing
the failure.

--
Regards,
Tom Ogilvy

"John" wrote in message
...
We are experiencing intermittent errors from "Finds" in
our macros. Generally these are when our macros have
performed over 200 searches. The Find suddenly fails
although if the search is performed on the worksheet it
achieves the find successfully. So while the data is
present, the search appears to have grown tired!

Is there a limit to the number of Finds allowed, or do
some buffers need clearing or is there some other solution
other than running the macro in sections to reduce the
volume of searches?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Find errors

Do you have merged cells in your worksheet?

Are you looking for a value in the merged cell?

In xl2002 (and I think xl2k), this fails after the 2nd find.

Option Explicit
Sub testme()
Dim FoundCell As Range

Worksheets.Add
Range("c4:d11").Merge
Range("c4").Value = "test"
Range("g2:i10").Merge
Range("g2").Value = "test"

Do
Set FoundCell = Cells.Find("test", after:=ActiveCell, _
lookat:=xlPart, LookIn:=xlValues, searchdirection:=xlNext)
If FoundCell Is Nothing Then
MsgBox "it blew up"
Exit Do
End If
FoundCell.Activate
Debug.Print FoundCell.Address
Loop

End Sub


If I comment out the .merge lines, then it'll become an endless loop and I need
to stop it with ctrl-break.

(I think xl97 didn't have this problem with merged cells and find.)



John wrote:

We are experiencing intermittent errors from "Finds" in
our macros. Generally these are when our macros have
performed over 200 searches. The Find suddenly fails
although if the search is performed on the worksheet it
achieves the find successfully. So while the data is
present, the search appears to have grown tired!

Is there a limit to the number of Finds allowed, or do
some buffers need clearing or is there some other solution
other than running the macro in sections to reduce the
volume of searches?

Thanks


--

Dave Peterson

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 to find errors in documents Pnoahjones Excel Discussion (Misc queries) 1 March 25th 10 04:29 AM
Find and Replace Lookup errors Julie Excel Discussion (Misc queries) 7 July 13th 07 09:36 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
To find errors Kalevi New Users to Excel 1 October 14th 05 03:43 PM
Find finds nothing, and errors Chris M.[_3_] Excel Programming 1 August 25th 03 06:31 PM


All times are GMT +1. The time now is 05: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"