View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How do you test to break out of a find loop?

Henry,

This should show you a technique

On Error Resume Next
Cells.Find(What:=":", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False) _
.Activate
If Err.Number < 0 Then
MsgBox "Not Found"
End If
On Error GoTo 0

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Henry Stock" wrote in message
...
I want to use the following in a Do While Loop, but I don't know how to

test
when the value I am searching for is not found.
One additional piece of information. When I do hit on a cell that has

this
value I modify the cell so that it no longer has the value I am
Do While (??????)
Cells.Find(What:=":", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False) _
.Activate
... Test to see if value is found.... Note... If value is not found I
know I can't activate a cell, but I
don't know where the active cell will end up
..... Other Processing ....
Loop


--
Henry Stock, Network Administrator
onProject.com
3 Wing Drive
Cedar Knolls, NJ 07927-1006