View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] carlos_ray86@hotmail.com is offline
external usenet poster
 
Posts: 67
Default Find error!!!! Is there any other way to do this?

I am trying to find any cell with the word stop in it and turn that
cell red. Later in the code I have all red cells delete. However, it
doesn't always work. Sometimes it does other times it doesn't.
Typically after I try running the program more than twice it stops
working. I've tried doing a step by step debug and it just skips over
the code as if the word stop was not in the sheet. My code is as
follows:

With Worksheets(1).Range("a1:a500")
Set c = .Find("Stop", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.ColorIndex = 3
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

I tried just deleting the cells within the find but it would do the
same thing so I tried it this way hoping because it's a simplier code
it would work better but that is not working out. Please help. If
there is a way to use a if statement or any other way please let me
know. THANKS TO ALL