View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default Can .FindNext return Nothing??

Wild Bill,

'Am I high, or shouldn't that say, "starts after the active cell" ??'

If by that you mean, is the activecell always in the upper left corner of
the range, I don't think so. The Find is not related to the Activecell
(unless you generate the code form the Recorder). If it is generated from
the Macro Recorder and you select a range before the Find, and you drag from
the bottom up or from right to left, the Activecell won't be the upper left
cell. Here's code recorded by dragging from lower right to upper left:

Range("C3:D9").Select
Range("D9").Activate

I'm not high, but I may have totally missed your point here. But I had fun
thinking about it.

Doug

"Wild Bill" wrote in message
.. .
Its wraparound nature suggests it would never return Nothing (assuming
that .Find itself didn't return nothing). Besides, the XL03 FindNext
Method help instructs you to test its returned address. So why check
for Nothing?

Moreover, why does their help show this?
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress

Why test if c is Nothing *AND* do the c.address wraparound test? Is
there an occasion where the wraparound doesn't happen? (I could see this
perhaps only if .Find failed; but that's not the case in the help text.)


In testing I can never get FindNEXT to return Nothing. Only FIND.

Separate question: the "After" argument help text in XL03 says "If this
argument isn't specified, the search starts after the cell in the
upper-left corner of the range." Am I high, or shouldn't that say,
"starts after the active cell" ??