Delete rows with common element

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Is there a way to delete all rows that contain a common text element (i.e.
"Holiday"). The remaining information in the records may differ from every
other row.--
Thank-you and all suggestions are appreciated.
 
yes. More info. where in the row? Only the word in the cell or holiday sss
in the same cell?
 
Try bellow code:-

Sharad

Sub DelRows()
Dim uRange As Range, delRange As Range
Set uRange = Worksheets("Sheet_Name_Here").UsedRange
Set delRange = uRange.Cells(uRange.Rows.Count + 1, 1).EntireRow
For Each c In uRange.Cells
If InStr(1, c.Value, "Holiday") > 0 Then
Set delRange = Union(delRange, c.EntireRow)
End If
Next c
delRange.Delete
End Sub
 
The text to be used as the "trigger" is located in Column B for each record.
If the key text phrase is located in this cell I would like the entire record
(row) to be deleted.
I have tried the advanced filter but it requires all the each record to be
identical.

Thank-you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top