View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default ClearContents if #VALUE! found in cell

Hi All........

This code works fine for a text string as "oldest", but I want it to work if
the cell value is #VALUE! (basically, clear or delete the row is the #VALUE!
error is found)

Dim oldest As String
oldest = Range("data!k1").Value 'value is a text string
With Sheets("ALL12")
lastrow = .Cells(.Rows.Count, "a").End(xlUp).Row
For r = lastrow To 12 Step -1

If .Cells(r, "b").Value Like oldest Then
.Rows(r).EntireRow.ClearContents
End If
Next r
End With

Any help would be much appreciated.......

Vaya con Dios,
Chuck