Removing rows featuring certain words

C

clane

Hello,

I am looking to remove all rows featuring a certain word in an activ
sheet. the word is confined to a single colum. I would like to use
macro to do this but if anyone can think of a way to do it short o
deleting each cell individually my self that would help too

thanks a million

Chuc
 
T

Tom Ogilvy

If the word is a constant value in the cell (not produced by a formula) and
stands alone.

Word = "word to look for"
With Columns(5)
.Replace What:=Word, Replacement:="=NA()", _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
MatchCase:=False
.SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Delete
End With
 
F

Frank Kabel

Hi
try the following macro:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "A").Value= "your_value" then
Rows(row_index).delete
End If
Next
Application.ScreenUpdating = True
End Sub
 
Top