ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing rows featuring certain words (https://www.excelbanter.com/excel-programming/304271-removing-rows-featuring-certain-words.html)

clane

Removing rows featuring certain words
 
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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Removing rows featuring certain words
 
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

--
Regards,
Tom Ogilvy



"clane " wrote in message
...
Hello,

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

thanks a million

Chuck


---
Message posted from http://www.ExcelForum.com/




Frank Kabel

Removing rows featuring certain words
 
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

-----Original Message-----
Hello,

I am looking to remove all rows featuring a certain word

in an active
sheet. the word is confined to a single colum. I would

like to use a
macro to do this but if anyone can think of a way to do

it short of
deleting each cell individually my self that would help

too

thanks a million

Chuck


---
Message posted from http://www.ExcelForum.com/

.


clane[_2_]

Removing rows featuring certain words
 
Thank you for your help,

i got them all removed :) :) :) :)

thanks a lot

Chuc

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com