View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JMay JMay is offline
external usenet poster
 
Posts: 422
Default Code bombing on Loop While line

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