Problem with Loop
Bob:
Thanks!
It is odd ... It's neat that you recognized this from
HELP.
Thanks again,
Mike.
-----Original Message-----
Hi Mike,
Odd isn't it. This is straight from help and it doesn't
work
The reason that it does not work is because when it is
not found, c is
nothing, and thus it is impossible to get the address of
c.
AFAICS all you need is
Loop While Not c Is Nothing
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Mike" wrote in
message
...
Hi. The following Loop works well until all of the
items
have been replaced. In the final loop, I receive the
following error: "Object variable or With Block
Variable
not set."
Any ideas?
Thanks,
Mike.
--------
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <
firstAddress
End If
End With
.
|