View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Code bombing on Loop While line

Jim,

Try this

With Worksheets(1).Range("A1:A10")
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
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JMay" wrote in message
news:xoYrf.105610$WH.103657@dukeread01...
The below code I copied from the Help screen under the Find Method of the

Range
Object:
It is properly changing 2 values to 5 values, but before concluding it is
"bombing" on the 3rd from the last line (below);
Can someone spot what the problem is?
TIA,

With Worksheets(1).Range("A1:A10")
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