ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete rows with common element (https://www.excelbanter.com/excel-programming/319371-delete-rows-common-element.html)

Anauna

Delete rows with common element
 
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.

Don Guillett[_4_]

Delete rows with common element
 
yes. More info. where in the row? Only the word in the cell or holiday sss
in the same cell?

--
Don Guillett
SalesAid Software

"Anauna" wrote in message
...
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.




Sharad

Delete rows with common element
 

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Anauna

Delete rows with common element
 
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
"Don Guillett" wrote:

yes. More info. where in the row? Only the word in the cell or holiday sss
in the same cell?

--
Don Guillett
SalesAid Software

"Anauna" wrote in message
...
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.






All times are GMT +1. The time now is 10:33 AM.

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