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 Look for value in a column and delete

This works for me

Sub FilterData()
Dim iLastRow As Long
Dim i As Long

aplication.ScreenUpdating = False
For i = 22 To 27 'V to AB
iLastRow = Cells(Rows.Count, i).End(xlUp).row
With Range(Cells(5, i), Cells(iLastRow, i))
If iLastRow = 6 Then
.AutoFilter Field:=1, Criteria1:="#N/A"
.SpecialCells(xlCellTypeVisible).ClearContents
End If
End With
Next i
Application.ScreenUpdating = True

End Sub


--

HTH

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


"Tempy" wrote in message
...
Hi all, maybe i did not explain my problem properly; I have 151 columns
and each one can be filtered.
There are between 10 and 5000 lines.
I need to look for #N/A in column "V:AB" starting at row 6 and once
found then i then need to delete all instances. This could be scattered
down the rows, however if row 10 has #N/A in column V then the other
columns will also have it in but i cannot delete the row but must delete
the contents of the cells.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***