View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Wild Bill[_2_] Wild Bill[_2_] is offline
external usenet poster
 
Posts: 90
Default Can .FindNext return Nothing??

Ah, very astute of you to pick that up! So c indeed could become
Nothing if c.Value is modified. Way to go! You're definitely underpaid
for what you do here :-O

It also occurred to me that break mode (i.e., stopping in Debug window)
could allow an action to result in a FindNext failure(e.g. changing
ActiveSheet), but I felt that the Nothing test in their example should
not have been written to contemplate that. Only real men would step
code, right, and they ought to be big enough to deal with such
consequences on their own time!

Now going beyond my original question, as you have established that
Nothing indeed is possible: as to kablewie, so much for left to right
evaluation in VBA - NOT! Boo! Shame on them! And since that happens, are
you saying that thus it is useless to test a range (cell) c for Is
Nothing, when c.address is in the same If? So their example should have
tested for nothing inside the loop and Exit Do, and let the While only
test the .Address?

On Fri, 29 Apr 2005 20:37:12 -0500, Dave Peterson
wrote:

Actually, I think the xl2003's help has the opposite bug that you describe.

I think that it won't wraparound to the first cell. The sample code is looking
for "2" and changes it to "5". So after it gets all the 2's, the .findnext will
return nothing.

And that causes a blowup in this portion:

Loop While Not c Is Nothing And c.Address < FirstAddress

Since c is nothing, c.address doesn't make sense (and kablewie!!!).